mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:39:25 +02:00
Qt: fixed seg fault with TCheckListBox, fixed passing OnItemClick when adding items.issue #20927
git-svn-id: trunk@34254 -
This commit is contained in:
parent
9305126522
commit
97b7e5c8ef
@ -564,6 +564,7 @@ begin
|
||||
inherited Put(Index, S);
|
||||
if Assigned(FWinControl) and (FWinControl.HandleAllocated) then
|
||||
begin
|
||||
FOwner.BeginUpdate;
|
||||
FOwner.setItemText(Index, S);
|
||||
if FOwner is TQtCheckListBox then
|
||||
begin
|
||||
@ -573,6 +574,7 @@ begin
|
||||
else
|
||||
FOwner.ItemFlags[Index] := FOwner.ItemFlags[Index] and not QtItemIsTristate;
|
||||
end;
|
||||
FOwner.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -581,6 +583,7 @@ begin
|
||||
inherited InsertItem(Index, S);
|
||||
if Assigned(FWinControl) and (FWinControl.HandleAllocated) then
|
||||
begin
|
||||
FOwner.BeginUpdate;
|
||||
FOwner.insertItem(Index, S);
|
||||
if FOwner is TQtCheckListBox then
|
||||
begin
|
||||
@ -590,6 +593,7 @@ begin
|
||||
else
|
||||
FOwner.ItemFlags[Index] := FOwner.ItemFlags[Index] and not QtItemIsTristate;
|
||||
end;
|
||||
FOwner.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -598,6 +602,7 @@ begin
|
||||
inherited InsertItem(Index, S, O);
|
||||
if Assigned(FWinControl) and (FWinControl.HandleAllocated) then
|
||||
begin
|
||||
FOwner.BeginUpdate;
|
||||
FOwner.insertItem(Index, S);
|
||||
|
||||
if FOwner is TQtCheckListBox then
|
||||
@ -608,6 +613,7 @@ begin
|
||||
else
|
||||
FOwner.ItemFlags[Index] := FOwner.ItemFlags[Index] and not QtItemIsTristate;
|
||||
end;
|
||||
FOwner.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -658,7 +664,11 @@ procedure TQtListStrings.Delete(Index: Integer);
|
||||
begin
|
||||
inherited Delete(Index);
|
||||
if Assigned(FWinControl) and (FWinControl.HandleAllocated) then
|
||||
begin
|
||||
FOwner.BeginUpdate;
|
||||
FOwner.removeItem(Index);
|
||||
FOwner.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TQtListStrings.Move(CurIndex, NewIndex: Integer);
|
||||
@ -695,8 +705,10 @@ begin
|
||||
inherited Sort;
|
||||
if Assigned(FWinControl) and (FWinControl.HandleAllocated) then
|
||||
begin
|
||||
FOwner.BeginUpdate;
|
||||
for I := 0 to Count - 1 do
|
||||
FOwner.setItemText(I, Strings[I]);
|
||||
FOwner.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -10758,6 +10758,8 @@ var
|
||||
APos: TQtPoint;
|
||||
AMouseEvent: QMouseEventH;
|
||||
begin
|
||||
if InUpdate or not GetVisible then
|
||||
exit;
|
||||
// fires only when checkBox clicked.
|
||||
QCursor_pos(@AGlobalPos);
|
||||
QWidget_mapFromGlobal(Widget, @APos, @AGlobalPos);
|
||||
|
Loading…
Reference in New Issue
Block a user