mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 11:29:31 +02:00
Qt,Qt5,Qt6: fixed buggy mouse capture with TSpinEdit, TFloatSpinEdit. issue #40725
(cherry picked from commit 27bc023a87
)
This commit is contained in:
parent
ea073bee6b
commit
b086f9dfa0
@ -1104,6 +1104,7 @@ type
|
||||
// parts
|
||||
FLineEdit: QLineEditH;
|
||||
FTextChangedByValueChanged: Boolean;
|
||||
FMouseCaptureFix: boolean; {issue #40725}
|
||||
function GetLineEdit: QLineEditH;
|
||||
function LineEditEventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl;
|
||||
protected
|
||||
@ -11776,10 +11777,11 @@ end;
|
||||
procedure TQtAbstractSpinBox.grabMouse;
|
||||
begin
|
||||
if Assigned(LCLObject) and not (csDesigning in LCLObject.ComponentState)
|
||||
and Assigned(LineEdit) then
|
||||
and Assigned(LineEdit) and not FMouseCaptureFix then
|
||||
QWidget_grabMouse(LineEdit)
|
||||
else
|
||||
inherited grabMouse;
|
||||
FMouseCaptureFix := False;
|
||||
end;
|
||||
|
||||
procedure TQtAbstractSpinBox.setAlignment(const AAlignment: QtAlignment);
|
||||
@ -11850,6 +11852,16 @@ begin
|
||||
(QKeyEvent_modifiers(QKeyEventH(Event)) = QtNoModifier)
|
||||
else
|
||||
IsDeleteKey := False;
|
||||
|
||||
{issue #40725}
|
||||
if (QEvent_type(Event) >= QEventMouseButtonPress) and (QEvent_type(Event) <= QEventMouseMove) then
|
||||
begin
|
||||
if (QEvent_type(Event) = QEventMouseButtonPress) and (LineEdit <> Sender) then
|
||||
FMouseCaptureFix := True
|
||||
else
|
||||
FMouseCaptureFix := False;
|
||||
end;
|
||||
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
{we must pass delete key to qt, qabstractspinbox doesn't like what we do}
|
||||
if IsDeleteKey then
|
||||
|
@ -1121,6 +1121,7 @@ type
|
||||
// parts
|
||||
FLineEdit: QLineEditH;
|
||||
FTextChangedByValueChanged: Boolean;
|
||||
FMouseCaptureFix: boolean; {issue #40725}
|
||||
function GetLineEdit: QLineEditH;
|
||||
function LineEditEventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl;
|
||||
protected
|
||||
@ -12045,10 +12046,11 @@ end;
|
||||
procedure TQtAbstractSpinBox.grabMouse;
|
||||
begin
|
||||
if Assigned(LCLObject) and not (csDesigning in LCLObject.ComponentState)
|
||||
and Assigned(LineEdit) then
|
||||
and Assigned(LineEdit) and not FMouseCaptureFix then
|
||||
QWidget_grabMouse(LineEdit)
|
||||
else
|
||||
inherited grabMouse;
|
||||
FMouseCaptureFix := False;
|
||||
end;
|
||||
|
||||
procedure TQtAbstractSpinBox.setAlignment(const AAlignment: QtAlignment);
|
||||
@ -12119,6 +12121,16 @@ begin
|
||||
(QKeyEvent_modifiers(QKeyEventH(Event)) = QtNoModifier)
|
||||
else
|
||||
IsDeleteKey := False;
|
||||
|
||||
{issue #40725}
|
||||
if (QEvent_type(Event) >= QEventMouseButtonPress) and (QEvent_type(Event) <= QEventMouseMove) then
|
||||
begin
|
||||
if (QEvent_type(Event) = QEventMouseButtonPress) and (LineEdit <> Sender) then
|
||||
FMouseCaptureFix := True
|
||||
else
|
||||
FMouseCaptureFix := False;
|
||||
end;
|
||||
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
{we must pass delete key to qt, qabstractspinbox doesn't like what we do}
|
||||
if IsDeleteKey then
|
||||
|
@ -1122,6 +1122,7 @@ type
|
||||
// parts
|
||||
FLineEdit: QLineEditH;
|
||||
FTextChangedByValueChanged: Boolean;
|
||||
FMouseCaptureFix: boolean; {issue #40725}
|
||||
function GetLineEdit: QLineEditH;
|
||||
function LineEditEventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl;
|
||||
protected
|
||||
@ -12072,10 +12073,11 @@ end;
|
||||
procedure TQtAbstractSpinBox.grabMouse;
|
||||
begin
|
||||
if Assigned(LCLObject) and not (csDesigning in LCLObject.ComponentState)
|
||||
and Assigned(LineEdit) then
|
||||
and Assigned(LineEdit) and not FMouseCaptureFix then
|
||||
QWidget_grabMouse(LineEdit)
|
||||
else
|
||||
inherited grabMouse;
|
||||
FMouseCaptureFix := False;
|
||||
end;
|
||||
|
||||
procedure TQtAbstractSpinBox.setAlignment(const AAlignment: QtAlignment);
|
||||
@ -12146,6 +12148,16 @@ begin
|
||||
(QKeyEvent_modifiers(QKeyEventH(Event)) = QtNoModifier)
|
||||
else
|
||||
IsDeleteKey := False;
|
||||
|
||||
{issue #40725}
|
||||
if (QEvent_type(Event) >= QEventMouseButtonPress) and (QEvent_type(Event) <= QEventMouseMove) then
|
||||
begin
|
||||
if (QEvent_type(Event) = QEventMouseButtonPress) and (LineEdit <> Sender) then
|
||||
FMouseCaptureFix := True
|
||||
else
|
||||
FMouseCaptureFix := False;
|
||||
end;
|
||||
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
{we must pass delete key to qt, qabstractspinbox doesn't like what we do}
|
||||
if IsDeleteKey then
|
||||
|
Loading…
Reference in New Issue
Block a user