From c5007165e567cffbdb6dfc9472d605636ad01da6 Mon Sep 17 00:00:00 2001 From: zeljko Date: Thu, 26 Nov 2009 11:17:36 +0000 Subject: [PATCH] Qt: fixed bug while introducing OwnerData. SetAllocBy() is dummy now git-svn-id: trunk@22796 - --- lcl/interfaces/qt/qtwidgets.pas | 10 ++++++++-- lcl/interfaces/qt/qtwscomctrls.pp | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index ecf1bdad88..f133de8924 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -7438,7 +7438,10 @@ var Items: TPtrIntArray; Item: QTreeWidgetItemH; begin + if AValue = ItemCount then + exit; BeginUpdate; + try ClearItems; SetLength(Items, AValue); for i := 0 to High(Items) do @@ -7446,8 +7449,11 @@ begin Item := QTreeWidgetItem_create(QTreeWidgetH(Widget), 0); Items[i] := PtrUInt(Item); end; - QTreeWidget_addTopLevelItems(QTreeWidgetH(Widget), @Items); - EndUpdate; + if length(Items) > 0 then + QTreeWidget_addTopLevelItems(QTreeWidgetH(Widget), @Items); + finally + EndUpdate; + end; end; procedure TQtTreeWidget.setMaxColSize(ACol: Integer; const AValue: Integer); diff --git a/lcl/interfaces/qt/qtwscomctrls.pp b/lcl/interfaces/qt/qtwscomctrls.pp index a76cdeb161..ecc7e77462 100644 --- a/lcl/interfaces/qt/qtwscomctrls.pp +++ b/lcl/interfaces/qt/qtwscomctrls.pp @@ -1348,8 +1348,8 @@ var begin if not WSCheckHandleAllocated(ALV, 'SetAllocBy') then Exit; - QtTreeWidget := TQtTreeWidget(ALV.Handle); - QtTreeWidget.ItemCount := AValue; + // QtTreeWidget := TQtTreeWidget(ALV.Handle); + // QtTreeWidget.ItemCount := AValue; end; class procedure TQtWSCustomListView.SetItemsCount(const ALV: TCustomListView;