mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-04 14:51:31 +01:00
Qt, Qt5: fixed wrong key release event after pressing ENTER in combobox dropdown list. issue #31574
git-svn-id: trunk@54710 -
This commit is contained in:
parent
08d04f01dd
commit
5893d28ac9
@ -1013,6 +1013,7 @@ type
|
||||
|
||||
TQtComboBox = class(TQtWidget, IQtEdit)
|
||||
private
|
||||
FKeyEnterFix: boolean; {issue #31574}
|
||||
FMouseFixPos: TQtPoint;
|
||||
// hooks
|
||||
FChangeHook: QComboBox_hookH;
|
||||
@ -11091,6 +11092,7 @@ begin
|
||||
{$ifdef VerboseQt}
|
||||
WriteLn('TQtComboBox.Create');
|
||||
{$endif}
|
||||
FKeyEnterFix := False; {issue #31574}
|
||||
FMouseFixPos := QtPoint(-1, -1);
|
||||
FDropListVisibleInternal := False;
|
||||
if AParams.WndParent <> 0 then
|
||||
@ -11577,13 +11579,22 @@ begin
|
||||
if (FDropList <> nil) and (Sender = FDropList.Widget) then
|
||||
begin
|
||||
if (Byte(QEvent_type(Event)) in [QEventKeyPress, QEventKeyRelease,QEventFontChange]) then
|
||||
begin
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
if Result and (QEvent_type(Event) = QEventKeyPress) then
|
||||
FKeyEnterFix := True; {issue #31574}
|
||||
end;
|
||||
QEvent_ignore(Event);
|
||||
exit;
|
||||
end;
|
||||
|
||||
BeginEventProcessing;
|
||||
try
|
||||
|
||||
if FKeyEnterFix and (Byte(QEvent_type(Event)) in [QEventMouseButtonPress, QEventMouseButtonDblClick,
|
||||
QEventMouseButtonRelease, QEventKeyPress, QEventHide, QEventShow]) then
|
||||
FKeyEnterFix := False; {issue #31574}
|
||||
|
||||
case QEvent_type(Event) of
|
||||
QEventFocusOut:
|
||||
begin
|
||||
@ -11685,6 +11696,13 @@ begin
|
||||
end else
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
end;
|
||||
QEventKeyRelease:
|
||||
begin
|
||||
{issue #31574}
|
||||
if not FKeyEnterFix then
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
FKeyEnterFix := False;
|
||||
end;
|
||||
else
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
end;
|
||||
|
||||
@ -1013,6 +1013,7 @@ type
|
||||
|
||||
TQtComboBox = class(TQtWidget, IQtEdit)
|
||||
private
|
||||
FKeyEnterFix: boolean; {issue #31574}
|
||||
FMouseFixPos: TQtPoint;
|
||||
// hooks
|
||||
FChangeHook: QComboBox_hookH;
|
||||
@ -11060,6 +11061,7 @@ begin
|
||||
{$ifdef VerboseQt}
|
||||
WriteLn('TQtComboBox.Create');
|
||||
{$endif}
|
||||
FKeyEnterFix := False; {issue #31574}
|
||||
FMouseFixPos := QtPoint(-1, -1);
|
||||
FDropListVisibleInternal := False;
|
||||
if AParams.WndParent <> 0 then
|
||||
@ -11549,13 +11551,20 @@ begin
|
||||
if (FDropList <> nil) and (Sender = FDropList.Widget) then
|
||||
begin
|
||||
if (Byte(QEvent_type(Event)) in [QEventKeyPress, QEventKeyRelease,QEventFontChange]) then
|
||||
begin
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
if Result and (QEvent_type(Event) = QEventKeyPress) then
|
||||
FKeyEnterFix := True; {issue #31574}
|
||||
end;
|
||||
QEvent_ignore(Event);
|
||||
exit;
|
||||
end;
|
||||
|
||||
BeginEventProcessing;
|
||||
try
|
||||
if FKeyEnterFix and (Byte(QEvent_type(Event)) in [QEventMouseButtonPress, QEventMouseButtonDblClick,
|
||||
QEventMouseButtonRelease, QEventKeyPress, QEventHide, QEventShow]) then
|
||||
FKeyEnterFix := False; {issue #31574}
|
||||
case QEvent_type(Event) of
|
||||
QEventFocusOut:
|
||||
begin
|
||||
@ -11657,6 +11666,13 @@ begin
|
||||
end else
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
end;
|
||||
QEventKeyRelease:
|
||||
begin
|
||||
{issue #31574}
|
||||
if not FKeyEnterFix then
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
FKeyEnterFix := False;
|
||||
end;
|
||||
else
|
||||
Result := inherited EventFilter(Sender, Event);
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user