mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 08:19:27 +02:00
Qt: fixed wrong sizing of rows in TListView when OwnerDraw = true. related to issue #29182
git-svn-id: trunk@50785 -
This commit is contained in:
parent
d4de0ecf4b
commit
8115c28e80
@ -11637,6 +11637,7 @@ var
|
|||||||
Bmp: TBitmap;
|
Bmp: TBitmap;
|
||||||
AIcon: QIconH;
|
AIcon: QIconH;
|
||||||
AOk: Boolean;
|
AOk: Boolean;
|
||||||
|
ASize: TSize;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
{do not set items during design time}
|
{do not set items during design time}
|
||||||
@ -11675,6 +11676,13 @@ begin
|
|||||||
ImgList := TCustomListViewHack(LCLObject).SmallImages;
|
ImgList := TCustomListViewHack(LCLObject).SmallImages;
|
||||||
if Assigned(ImgList) then
|
if Assigned(ImgList) then
|
||||||
begin
|
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;
|
AImageIndex := TCustomListViewHack(LCLObject).Items[TopItem].ImageIndex;
|
||||||
if (ImgList.Count > 0) and
|
if (ImgList.Count > 0) and
|
||||||
((AImageIndex >= 0) and (AImageIndex < ImgList.Count)) then
|
((AImageIndex >= 0) and (AImageIndex < ImgList.Count)) then
|
||||||
@ -13742,6 +13750,7 @@ var
|
|||||||
Bmp: TBitmap;
|
Bmp: TBitmap;
|
||||||
AOk: Boolean;
|
AOk: Boolean;
|
||||||
AIcon: QIconH;
|
AIcon: QIconH;
|
||||||
|
ASize: TSize;
|
||||||
begin
|
begin
|
||||||
{do not set items during design time}
|
{do not set items during design time}
|
||||||
if csDesigning in LCLObject.ComponentState then
|
if csDesigning in LCLObject.ComponentState then
|
||||||
@ -13773,7 +13782,6 @@ begin
|
|||||||
|
|
||||||
TopItem := getRow(item);
|
TopItem := getRow(item);
|
||||||
RowHeight := getRowHeight(TopItem);
|
RowHeight := getRowHeight(TopItem);
|
||||||
|
|
||||||
if (TopItem < 0) or (TopItem > TCustomListViewHack(LCLObject).Items.Count - 1) then
|
if (TopItem < 0) or (TopItem > TCustomListViewHack(LCLObject).Items.Count - 1) then
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -13798,6 +13806,13 @@ begin
|
|||||||
ImgList := TCustomListViewHack(LCLObject).SmallImages;
|
ImgList := TCustomListViewHack(LCLObject).SmallImages;
|
||||||
if Assigned(ImgList) then
|
if Assigned(ImgList) then
|
||||||
begin
|
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;
|
AImageIndex := TCustomListViewHack(LCLObject).Items[TopItem].ImageIndex;
|
||||||
if (ImgList.Count > 0) and
|
if (ImgList.Count > 0) and
|
||||||
((AImageIndex >= 0) and (AImageIndex < ImgList.Count)) then
|
((AImageIndex >= 0) and (AImageIndex < ImgList.Count)) then
|
||||||
|
Loading…
Reference in New Issue
Block a user