Qt5: set mouse capture automatically. Qt4 and Qt6 works correct without such patch. issue #41341

This commit is contained in:
zeljan1 2025-02-07 14:47:57 +01:00
parent 84d6f2e2e3
commit eba745ba63

View File

@ -875,6 +875,32 @@ begin
FreeSysColorBrushes(True);
end;
end;
QEventMouseButtonPress:
begin
if QObject_isWidgetType(Sender) then
begin
W := TQtWidget(HwndFromWidgetH(QWidgetH(Sender)));
if (W <> nil) and QWidget_isVisible(QWidgetH(Sender)) and QWidget_isEnabled(QWidgetH(Sender)) then
begin
if QWidget_focusPolicy(QWidgetH(Sender)) <> QtNoFocus then
begin
QWidget_grabMouse(QWidgetH(Sender));
end;
end;
end;
end;
QEventMouseButtonRelease:
begin
if QObject_isWidgetType(Sender) then
begin
W := TQtWidget(HwndFromWidgetH(QWidgetH(Sender)));
if W <> nil then
QWidget_releaseMouse(QWidgetH(Sender));
end;
end;
{$IFNDEF QTUSEFOCUSCHANGEDHOOK}
QEventFocusIn:
begin