mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 08:09:31 +02:00
Qt: better patch for imageList changes in TQtListWidget. issue #26770
git-svn-id: trunk@46313 -
This commit is contained in:
parent
3c1ac1d84c
commit
3ac9d3afcc
@ -1973,10 +1973,6 @@ class procedure TQtWSCustomListView.SetImageList(const ALV: TCustomListView;
|
||||
const AList: TListViewImageList; const AValue: TCustomImageList);
|
||||
var
|
||||
QtListWidget: TQtListWidget;
|
||||
ItemViewWidget: QAbstractItemViewH;
|
||||
Size: TSize;
|
||||
x: Integer;
|
||||
LWI: QListWidgetItemH;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(ALV, 'SetImageList') then
|
||||
Exit;
|
||||
@ -1985,48 +1981,9 @@ begin
|
||||
exit;
|
||||
|
||||
QtListWidget := TQtListWidget(ALV.Handle);
|
||||
// issue #26770 , imediatelly apply changes.
|
||||
if TViewStyle(QtListWidget.ViewStyle) in [vsIcon, vsSmallIcon] then
|
||||
begin
|
||||
ItemViewWidget := QListWidgetH(QtListWidget.Widget);
|
||||
case QtListWidget.ViewStyle of
|
||||
Ord(vsIcon):
|
||||
begin
|
||||
if Assigned(TListView(ALV).LargeImages) then
|
||||
begin
|
||||
Size.cy := TListView(ALV).LargeImages.Height;
|
||||
Size.cx := TListView(ALV).LargeImages.Width;
|
||||
end else
|
||||
begin
|
||||
x := GetPixelMetric(QStylePM_IconViewIconSize, nil, ItemViewWidget);
|
||||
Size.cx := x;
|
||||
Size.cy := x;
|
||||
end;
|
||||
end;
|
||||
Ord(vsSmallIcon):
|
||||
begin
|
||||
if Assigned(TListView(ALV).SmallImages) then
|
||||
begin
|
||||
Size.cy := TListView(ALV).SmallImages.Height;
|
||||
Size.cx := TListView(ALV).SmallImages.Width;
|
||||
end else
|
||||
begin
|
||||
x := GetPixelMetric(QStylePM_ListViewIconSize, nil, ItemViewWidget);
|
||||
Size.cx := x;
|
||||
Size.cy := x;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
TQtAbstractItemView(ALV.Handle).IconSize := Size;
|
||||
LWI := QtListWidget.getItem(0);
|
||||
if LWI <> nil then
|
||||
begin
|
||||
X := Size.CY;
|
||||
QListWidgetItem_sizeHint(LWI, @Size);
|
||||
Size.Cy := X;
|
||||
QListWidgetItem_setSizeHint(LWI, @Size);
|
||||
end;
|
||||
end;
|
||||
RecreateWnd(ALV);
|
||||
end;
|
||||
|
||||
class procedure TQtWSCustomListView.SetItemsCount(const ALV: TCustomListView;
|
||||
|
Loading…
Reference in New Issue
Block a user