mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 17:00:19 +02:00
Qt: fixed extra mousewheel events on TQtAbstractControl based widgets.issue #25992
git-svn-id: trunk@44667 -
This commit is contained in:
parent
532b6e1e0f
commit
9718b5cd57
@ -410,6 +410,7 @@ type
|
|||||||
FHScrollbar: TQtScrollBar;
|
FHScrollbar: TQtScrollBar;
|
||||||
FVScrollbar: TQtScrollbar;
|
FVScrollbar: TQtScrollbar;
|
||||||
public
|
public
|
||||||
|
function EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl; override;
|
||||||
procedure grabMouse; override;
|
procedure grabMouse; override;
|
||||||
function GetContainerWidget: QWidgetH; override;
|
function GetContainerWidget: QWidgetH; override;
|
||||||
function getClientOffset: TPoint; override;
|
function getClientOffset: TPoint; override;
|
||||||
@ -6549,8 +6550,8 @@ begin
|
|||||||
{$IFDEF QTSCROLLABLEFORMS}
|
{$IFDEF QTSCROLLABLEFORMS}
|
||||||
if Assigned(ScrollArea) and not IsMDIChild then
|
if Assigned(ScrollArea) and not IsMDIChild then
|
||||||
begin
|
begin
|
||||||
if QEvent_type(Event) in [QEventPaint,
|
if QEvent_type(Event) in
|
||||||
QEventContextMenu] then
|
[QEventPaint, QEventContextMenu, QEventWheel] then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -8070,16 +8071,29 @@ begin
|
|||||||
else
|
else
|
||||||
if (QEvent_type(Event) = QEventWheel) and Assigned(FOwner) and
|
if (QEvent_type(Event) = QEventWheel) and Assigned(FOwner) and
|
||||||
(
|
(
|
||||||
{$IFDEF QTSCROLLABLEFORMS}
|
(FOwner is TQtAbstractScrollArea)
|
||||||
(FOwner is TQtWindowArea) or
|
|
||||||
{$ENDIF}
|
|
||||||
(FOwner is TQtCustomControl)
|
|
||||||
) then
|
) then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
// issue #25992
|
||||||
|
if not getVisible then
|
||||||
|
Result := FOwner.SlotMouseWheel(FOwner.Widget, Event)
|
||||||
|
else
|
||||||
Result := inherited EventFilter(Sender, Event);
|
Result := inherited EventFilter(Sender, Event);
|
||||||
// do not scroll when disabled
|
|
||||||
|
// DebugLn('TQtScrollBar.EventFilter: QEventWheel ',dbgsName(LCLObject),' Result=',dbgs(Result));
|
||||||
|
|
||||||
|
// do not scroll when disabled or issue #25992
|
||||||
if not getEnabled then
|
if not getEnabled then
|
||||||
|
Result := True
|
||||||
|
else
|
||||||
|
if not getVisible then
|
||||||
|
begin
|
||||||
|
if {$IFDEF QTSCROLLABLEFORMS}(FOwner is TQtWindowArea) or {$ENDIF}
|
||||||
|
(FOwner.ChildOfComplexWidget in
|
||||||
|
[ccwScrollingWinControl, ccwScrollingWindow]) then
|
||||||
Result := True;
|
Result := True;
|
||||||
|
end;
|
||||||
end else
|
end else
|
||||||
Result := False;
|
Result := False;
|
||||||
if (QEvent_type(Event) = QEventKeyRelease) and not
|
if (QEvent_type(Event) = QEventKeyRelease) and not
|
||||||
@ -15307,6 +15321,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TQtAbstractScrollArea.EventFilter(Sender: QObjectH; Event: QEventH
|
||||||
|
): Boolean; cdecl;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
if (QEvent_type(Event) = QEventWheel) and
|
||||||
|
not (FChildOfComplexWidget in
|
||||||
|
[ccwCustomControl, ccwScrollingWinControl, ccwScrollingWindow]) then
|
||||||
|
// issue #25992.Do not propagate wheel event to lcl, it is done via TQtScrollBar.EventFilter.
|
||||||
|
else
|
||||||
|
Result:=inherited EventFilter(Sender, Event);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TQtAbstractScrollArea.grabMouse;
|
procedure TQtAbstractScrollArea.grabMouse;
|
||||||
var
|
var
|
||||||
W: QWidgetH;
|
W: QWidgetH;
|
||||||
|
Loading…
Reference in New Issue
Block a user