From db2d5e907e2bab3b0aa571ce1d718f64b3b58bc4 Mon Sep 17 00:00:00 2001 From: ondrej Date: Mon, 23 May 2016 14:48:02 +0000 Subject: [PATCH] qt: add support for WM_NCHITTEST=HTTRANSPARENT windows. git-svn-id: trunk@52359 - --- lcl/interfaces/qt/qtwidgets.pas | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index 7edc38d8d5..d9d083c731 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -3521,12 +3521,13 @@ end; function TQtWidget.SlotMouse(Sender: QObjectH; Event: QEventH): Boolean; cdecl; var Msg: TLMMouse; - MousePos: TQtPoint; MButton: QTMouseButton; Modifiers: QtKeyboardModifiers; SaveWidget: QWidgetH; LazButton: Byte; LazPos: TPoint; + TrgHandle: TQtWidget; + TrgControl: TWinControl; begin {$ifdef VerboseQt} WriteLn('TQtWidget.SlotMouse'); @@ -3534,6 +3535,19 @@ begin Result := False; // allow qt to handle message + TrgHandle := Self; + TrgControl := LCLObject; + CheckTransparentWindow(TLCLIntfHandle(TrgHandle), TrgControl); + if (TrgHandle=nil) or (TrgControl=nil) then + begin + Exit; + end else + if (TrgHandle<>Self) then + begin + Result := TQtWidget(TrgHandle).SlotMouse(Sender, Event); + Exit; + end; + if not CanSendLCLMessage then exit(True); @@ -3545,17 +3559,15 @@ begin FillChar(Msg{%H-}, SizeOf(Msg), #0); - MousePos := QMouseEvent_pos(QMouseEventH(Event))^; - OffsetMousePos(@MousePos); + LazPos := LCLObject.ScreenToClient(Mouse.CursorPos); Modifiers := QInputEvent_modifiers(QInputEventH(Event)); Msg.Keys := QtKeyModifiersToKeyState(Modifiers, False, nil); - Msg.XPos := SmallInt(MousePos.X); - Msg.YPos := SmallInt(MousePos.Y); + Msg.XPos := SmallInt(LazPos.X); + Msg.YPos := SmallInt(LazPos.Y); MButton := QMouseEvent_Button(QMouseEventH(Event)); - LazPos := Point(MousePos.X, MousePos.Y); Msg.Keys := Msg.Keys or QtButtonsToLCLButtons(MButton); case MButton of QtLeftButton: LazButton := 1;