Qt,Qt5,Qt6: fixed error with sorted TQtComboStrings. issue #40353

(cherry picked from commit dcf14bec5a)
This commit is contained in:
Željan Rikalo 2023-06-28 10:17:16 +02:00 committed by Maxim Ganetsky
parent 37e1398b1c
commit 21f35c1381
3 changed files with 27 additions and 21 deletions

View File

@ -566,15 +566,17 @@ begin
end;
function TQtComboStrings.Add(const S: String): Integer;
var
I: Integer;
begin
if FSorted then
Result := inherited Add(S);
if FSorted and Assigned(FWinControl) and (FWinControl.HandleAllocated) then
begin
Find(S, Result);
FChanging := True;
Insert(Result, S);
FChanging := False;
end else
Result := inherited Add(S);
FOwner.BeginUpdate;
for I := 0 to Count - 1 do
FOwner.setItemText(I, Strings[I]);
FOwner.EndUpdate;
end;
end;
procedure TQtComboStrings.Assign(Source: TPersistent);

View File

@ -570,15 +570,17 @@ begin
end;
function TQtComboStrings.Add(const S: String): Integer;
var
I: Integer;
begin
if FSorted then
Result := inherited Add(S);
if FSorted and Assigned(FWinControl) and (FWinControl.HandleAllocated) then
begin
Find(S, Result);
FChanging := True;
Insert(Result, S);
FChanging := False;
end else
Result := inherited Add(S);
FOwner.BeginUpdate;
for I := 0 to Count - 1 do
FOwner.setItemText(I, Strings[I]);
FOwner.EndUpdate;
end;
end;
procedure TQtComboStrings.Assign(Source: TPersistent);

View File

@ -570,15 +570,17 @@ begin
end;
function TQtComboStrings.Add(const S: String): Integer;
var
I: Integer;
begin
if FSorted then
Result := inherited Add(S);
if FSorted and Assigned(FWinControl) and (FWinControl.HandleAllocated) then
begin
Find(S, Result);
FChanging := True;
Insert(Result, S);
FChanging := False;
end else
Result := inherited Add(S);
FOwner.BeginUpdate;
for I := 0 to Count - 1 do
FOwner.setItemText(I, Strings[I]);
FOwner.EndUpdate;
end;
end;
procedure TQtComboStrings.Assign(Source: TPersistent);