mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-23 17:52:16 +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;
|
||||
FVScrollbar: TQtScrollbar;
|
||||
public
|
||||
function EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl; override;
|
||||
procedure grabMouse; override;
|
||||
function GetContainerWidget: QWidgetH; override;
|
||||
function getClientOffset: TPoint; override;
|
||||
@ -6549,8 +6550,8 @@ begin
|
||||
{$IFDEF QTSCROLLABLEFORMS}
|
||||
if Assigned(ScrollArea) and not IsMDIChild then
|
||||
begin
|
||||
if QEvent_type(Event) in [QEventPaint,
|
||||
QEventContextMenu] then
|
||||
if QEvent_type(Event) in
|
||||
[QEventPaint, QEventContextMenu, QEventWheel] then
|
||||
exit;
|
||||
end;
|
||||
{$ENDIF}
|
||||
@ -8070,16 +8071,29 @@ begin
|
||||
else
|
||||
if (QEvent_type(Event) = QEventWheel) and Assigned(FOwner) and
|
||||
(
|
||||
{$IFDEF QTSCROLLABLEFORMS}
|
||||
(FOwner is TQtWindowArea) or
|
||||
{$ENDIF}
|
||||
(FOwner is TQtCustomControl)
|
||||
(FOwner is TQtAbstractScrollArea)
|
||||
) then
|
||||
begin
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
// do not scroll when disabled
|
||||
|
||||
// issue #25992
|
||||
if not getVisible then
|
||||
Result := FOwner.SlotMouseWheel(FOwner.Widget, Event)
|
||||
else
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
|
||||
// DebugLn('TQtScrollBar.EventFilter: QEventWheel ',dbgsName(LCLObject),' Result=',dbgs(Result));
|
||||
|
||||
// do not scroll when disabled or issue #25992
|
||||
if not getEnabled then
|
||||
Result := True;
|
||||
Result := True
|
||||
else
|
||||
if not getVisible then
|
||||
begin
|
||||
if {$IFDEF QTSCROLLABLEFORMS}(FOwner is TQtWindowArea) or {$ENDIF}
|
||||
(FOwner.ChildOfComplexWidget in
|
||||
[ccwScrollingWinControl, ccwScrollingWindow]) then
|
||||
Result := True;
|
||||
end;
|
||||
end else
|
||||
Result := False;
|
||||
if (QEvent_type(Event) = QEventKeyRelease) and not
|
||||
@ -15307,6 +15321,18 @@ begin
|
||||
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;
|
||||
var
|
||||
W: QWidgetH;
|
||||
|
Loading…
Reference in New Issue
Block a user