mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-02 11:10:12 +02:00
Qt: Make mousewheel useable with all TCustomControls.
git-svn-id: trunk@12329 -
This commit is contained in:
parent
852f93d82f
commit
5775337ed1
@ -306,6 +306,8 @@ type
|
||||
|
||||
{ TQtViewPort }
|
||||
TQtViewPort = class(TQtWidget)
|
||||
private
|
||||
FViewPortInMouseWheel: Boolean;
|
||||
public
|
||||
function getClientBounds: TRect; override;
|
||||
procedure OffsetMousePos(APoint: PQtPoint); override;
|
||||
@ -6392,6 +6394,11 @@ var
|
||||
begin
|
||||
case QEvent_type(Event) of
|
||||
QEventResize: Result := False;
|
||||
QEventWheel:
|
||||
begin
|
||||
FViewPortInMouseWheel := True;
|
||||
Result := False;
|
||||
end;
|
||||
QEventLayoutRequest:
|
||||
begin
|
||||
{TODO: something here (maybe) }
|
||||
@ -6446,6 +6453,16 @@ begin
|
||||
QEventMouseButtonPress,
|
||||
QEventMouseButtonRelease,
|
||||
QEventMouseButtonDblClick: Result := False;
|
||||
QEventWheel:
|
||||
begin
|
||||
if viewport.FViewPortInMouseWheel then
|
||||
begin
|
||||
QEvent_ignore(Event);
|
||||
viewport.FViewPortInMouseWheel := False;
|
||||
ViewPortEventFilter(Event, @Result);
|
||||
end else
|
||||
Result := False;
|
||||
end;
|
||||
else
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
end;
|
||||
@ -6655,6 +6672,7 @@ begin
|
||||
exit;
|
||||
FillChar(AParams, SizeOf(AParams), #0);
|
||||
FViewPortWidget := TQtViewPort.Create(LCLObject, AParams);
|
||||
FViewPortWidget.FViewPortInMouseWheel := False;
|
||||
FViewPortWidget.setFocusProxy(Widget);
|
||||
FViewPortWidget.setBackgroundRole(QPaletteNoRole);
|
||||
FViewPortWidget.setAutoFillBackground(False);
|
||||
|
Loading…
Reference in New Issue
Block a user