mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 13:39:18 +02:00
Qt,Qt5,Qt6: fixed error with sorted TQtComboStrings. issue #40353
(cherry picked from commit dcf14bec5a
)
This commit is contained in:
parent
37e1398b1c
commit
21f35c1381
@ -566,15 +566,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtComboStrings.Add(const S: String): Integer;
|
function TQtComboStrings.Add(const S: String): Integer;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
if FSorted then
|
Result := inherited Add(S);
|
||||||
|
if FSorted and Assigned(FWinControl) and (FWinControl.HandleAllocated) then
|
||||||
begin
|
begin
|
||||||
Find(S, Result);
|
FOwner.BeginUpdate;
|
||||||
FChanging := True;
|
for I := 0 to Count - 1 do
|
||||||
Insert(Result, S);
|
FOwner.setItemText(I, Strings[I]);
|
||||||
FChanging := False;
|
FOwner.EndUpdate;
|
||||||
end else
|
end;
|
||||||
Result := inherited Add(S);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtComboStrings.Assign(Source: TPersistent);
|
procedure TQtComboStrings.Assign(Source: TPersistent);
|
||||||
|
@ -570,15 +570,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtComboStrings.Add(const S: String): Integer;
|
function TQtComboStrings.Add(const S: String): Integer;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
if FSorted then
|
Result := inherited Add(S);
|
||||||
|
if FSorted and Assigned(FWinControl) and (FWinControl.HandleAllocated) then
|
||||||
begin
|
begin
|
||||||
Find(S, Result);
|
FOwner.BeginUpdate;
|
||||||
FChanging := True;
|
for I := 0 to Count - 1 do
|
||||||
Insert(Result, S);
|
FOwner.setItemText(I, Strings[I]);
|
||||||
FChanging := False;
|
FOwner.EndUpdate;
|
||||||
end else
|
end;
|
||||||
Result := inherited Add(S);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtComboStrings.Assign(Source: TPersistent);
|
procedure TQtComboStrings.Assign(Source: TPersistent);
|
||||||
|
@ -570,15 +570,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TQtComboStrings.Add(const S: String): Integer;
|
function TQtComboStrings.Add(const S: String): Integer;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
if FSorted then
|
Result := inherited Add(S);
|
||||||
|
if FSorted and Assigned(FWinControl) and (FWinControl.HandleAllocated) then
|
||||||
begin
|
begin
|
||||||
Find(S, Result);
|
FOwner.BeginUpdate;
|
||||||
FChanging := True;
|
for I := 0 to Count - 1 do
|
||||||
Insert(Result, S);
|
FOwner.setItemText(I, Strings[I]);
|
||||||
FChanging := False;
|
FOwner.EndUpdate;
|
||||||
end else
|
end;
|
||||||
Result := inherited Add(S);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQtComboStrings.Assign(Source: TPersistent);
|
procedure TQtComboStrings.Assign(Source: TPersistent);
|
||||||
|
Loading…
Reference in New Issue
Block a user