Qt: fixed getting displaysize of TListView.Item drIcon. part of issue #27509

git-svn-id: trunk@47923 -
This commit is contained in:
zeljko 2015-02-20 19:18:16 +00:00
parent 842dc80fd5
commit eaf152e0d7

View File

@ -1607,16 +1607,33 @@ begin
if ACode in [drIcon] then if ACode in [drIcon] then
begin begin
AIcon := QIcon_create(); AIcon := QIcon_create();
QTreeWidgetItem_icon(TWI, AIcon, 0); try
if not QIcon_isNull(AIcon) then QTreeWidgetItem_icon(TWI, AIcon, 0);
begin if not QIcon_isNull(AIcon) then
Size.cx := 0; begin
Size.cy := 0; Size.cx := 0;
QIcon_actualSize(AIcon, @Size, @Size); Size.cy := 0;
Result.Right := Result.Left + Size.cx; QIcon_actualSize(AIcon, @Size, @Size);
Result.Bottom := Result.Top + Size.cy; if (Size.cx = 0) or (Size.cy = 0) then
begin
if Assigned(TCustomListViewHack(ALV).SmallImages) then
Result.Right := Result.Left + TCustomListViewHack(ALV).SmallImages.Width;
end else
begin
Result.Right := Result.Left + Size.cx;
Result.Bottom := Result.Top + Size.cy;
end;
end else
begin
if QtTreeWidget.OwnerData then
begin
if Assigned(TCustomListViewHack(ALV).SmallImages) then
Result.Right := Result.Left + TCustomListViewHack(ALV).SmallImages.Width;
end;
end;
finally
QIcon_destroy(AIcon);
end; end;
QIcon_destroy(AIcon);
end; end;
end; end;
end; end;