Qt,Qt5,Qt6: do not clear editable combobox edit text if items are cleared. issue #40734

This commit is contained in:
Željan Rikalo 2024-01-29 20:08:05 +01:00
parent 5c01e6a88e
commit 1dbfb8fee2
3 changed files with 24 additions and 0 deletions

View File

@ -571,13 +571,21 @@ begin
end;
procedure TQtComboStrings.Clear;
var
AText: WideString;
begin
inherited Clear;
if Assigned(FWinControl) and (FWinControl.HandleAllocated) then
begin
FOwner.BeginUpdate;
if FOwner.getEditable then
AText := FOwner.LineEdit.getText
else
AText := '';
FOwner.ClearItems;
if (AText <> '') then
FOwner.setText(AText);
FOwner.EndUpdate;
end;
end;

View File

@ -572,13 +572,21 @@ begin
end;
procedure TQtComboStrings.Clear;
var
AText: WideString;
begin
inherited Clear;
if Assigned(FWinControl) and (FWinControl.HandleAllocated) then
begin
FOwner.BeginUpdate;
if FOwner.getEditable then
AText := FOwner.LineEdit.getText
else
AText := '';
FOwner.ClearItems;
if (AText <> '') then
FOwner.setText(AText);
FOwner.EndUpdate;
end;
end;

View File

@ -575,13 +575,21 @@ begin
end;
procedure TQtComboStrings.Clear;
var
AText: WideString;
begin
inherited Clear;
if Assigned(FWinControl) and (FWinControl.HandleAllocated) then
begin
FOwner.BeginUpdate;
if FOwner.getEditable then
AText := FOwner.LineEdit.getText
else
AText := '';
FOwner.ClearItems;
if (AText <> '') then
FOwner.setText(AText);
FOwner.EndUpdate;
end;
end;