From 00419b8bb302b39dd63840dce6f4fd1e68f284ce Mon Sep 17 00:00:00 2001 From: zeljko Date: Fri, 18 Jan 2013 09:11:57 +0000 Subject: [PATCH] Qt: fixed SetCapture() and GetCapture() for TQtCustomControl on qtwin32 targets git-svn-id: trunk@39878 - --- lcl/interfaces/qt/qtwinapi.inc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/qt/qtwinapi.inc b/lcl/interfaces/qt/qtwinapi.inc index c85a8f116e..0b9d5089f3 100644 --- a/lcl/interfaces/qt/qtwinapi.inc +++ b/lcl/interfaces/qt/qtwinapi.inc @@ -2526,6 +2526,13 @@ begin // Capture widget can be child of complex control. In any case we should return TQtWidget as result. // So we will look for parent while not found apropriate LCL handle. Widget := GetFirstQtObjectFromWidgetH(w); + {$IFDEF MSWINDOWS} + if Widget <> nil then + begin + if Widget is TQtCustomControl then + Widget := TQtCustomControl(Widget).Viewport; + end; + {$ENDIF} Result := HWND(Widget); end else @@ -5530,7 +5537,11 @@ begin if IsValidHandle(AHandle) then begin {$IFDEF MSWINDOWS} - Windows.SetCapture(QWidget_winID(TQtWidget(AHandle).Widget)); + if TQtWidget(AHandle) is TQtCustomControl then + begin + Windows.SetCapture(QWidget_winID(TQtCustomControl(AHandle).Viewport.Widget)) + end else + Windows.SetCapture(QWidget_winID(TQtWidget(AHandle).Widget)); {$ELSE} TQtWidget(AHandle).grabMouse(); {$ENDIF}