From 8115c28e806ed59ffb8e22e0ee17f2bd5c4ea745 Mon Sep 17 00:00:00 2001 From: zeljko Date: Mon, 14 Dec 2015 09:25:56 +0000 Subject: [PATCH] Qt: fixed wrong sizing of rows in TListView when OwnerDraw = true. related to issue #29182 git-svn-id: trunk@50785 - --- lcl/interfaces/qt/qtwidgets.pas | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index 3ee94b6d50..10e1d679bd 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -11637,6 +11637,7 @@ var Bmp: TBitmap; AIcon: QIconH; AOk: Boolean; + ASize: TSize; begin {do not set items during design time} @@ -11675,6 +11676,13 @@ begin ImgList := TCustomListViewHack(LCLObject).SmallImages; if Assigned(ImgList) then begin + QListWidgetItem_sizeHint(item, @ASize); + if (ASize.cx <> ImgList.Width) or (ASize.cx <> ImgList.Height) then + begin + ASize.cx := ImgList.Width; + ASize.cy := ImgList.Height; + QListWidgetItem_setSizeHint(item, @ASize); + end; AImageIndex := TCustomListViewHack(LCLObject).Items[TopItem].ImageIndex; if (ImgList.Count > 0) and ((AImageIndex >= 0) and (AImageIndex < ImgList.Count)) then @@ -13742,6 +13750,7 @@ var Bmp: TBitmap; AOk: Boolean; AIcon: QIconH; + ASize: TSize; begin {do not set items during design time} if csDesigning in LCLObject.ComponentState then @@ -13773,7 +13782,6 @@ begin TopItem := getRow(item); RowHeight := getRowHeight(TopItem); - if (TopItem < 0) or (TopItem > TCustomListViewHack(LCLObject).Items.Count - 1) then continue; @@ -13798,6 +13806,13 @@ begin ImgList := TCustomListViewHack(LCLObject).SmallImages; if Assigned(ImgList) then begin + QTreeWidgetItem_sizeHint(item, @ASize, 0); + if (ASize.cx <> ImgList.Width) or (ASize.cx <> ImgList.Height) then + begin + ASize.cx := ImgList.Width; + ASize.cy := ImgList.Height; + QTreeWidgetItem_setSizeHint(item, 0, @ASize); + end; AImageIndex := TCustomListViewHack(LCLObject).Items[TopItem].ImageIndex; if (ImgList.Count > 0) and ((AImageIndex >= 0) and (AImageIndex < ImgList.Count)) then