View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0027043||Lazarus||LCL||public||2014-11-14 18:31||2015-05-30 00:51|
|Reporter||Juha Manninen||Assigned To||Zeljan Rikalo|
|Product Version||1.3 (SVN)|
|Summary||0027043: TListView does not allow setting item height with GTK2 and QT|
|Description||The list has icons which are drawn in CustomDrawItem.|
It works on Windows by assigning the correct ImageList to SmallImages.
The same system is used in TTreeView. An item's height gets calculated from the icon size.
This does not work with GTK2 and QT on Linux. (I did not test iOS.)
Item height remains too small and parts of icons are cut off.
TCompPaletteOptionsFrame has good example code. The effect can be seen in environment options -> Component palette page.
See Additional Information for code snippets.
|Additional Information||Example code from the component palette options :|
Initially assigning an ImageList to SmallImages (method TCompPaletteOptionsFrame.Setup) :
ComponentsListView.SmallImages := IDEImages.Images_24;
The CustomDrawItem handler :
procedure TCompPaletteOptionsFrame.ComponentsListViewCustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
Comp := TRegisteredComponent(Item.Data);
ARect := Item.DisplayRect(drIcon);
if Comp is TPkgComponent then begin
CurIcon := TPkgComponent(Comp).Icon;
if CurIcon<>nil then
Sender.Canvas.Draw(ARect.Left+(25-CurIcon.Width) div 2,
ARect.Top+(ARect.Bottom-ARect.Top-CurIcon.Height) div 2, CurIcon);
|Tags||No tags attached.|
|Fixed in Revision||46851,46853,47415,47418|
|Widgetset||GTK 2, QT|
||Juha, please test Qt with r46851.|
||Works well, thanks.|
Please test and close if ok.
NOTE: IMO, this is not good way to paint TListView in cross platform way.Better would be to set OwnerDraw to true and use OnDrawItem() to completely draw icons and text.
Sorry, I have to reopen.
Looking more carefully at the QT ListView, the icon and text are not aligned.
Text is higher than icon.
Also the gap between items is maybe 2 pix bigger than in Windows, and it appears too big. The Windows version is pretty much perfect in this respect.
IMO the GTK2 version did not change at all. Parts of the icons are still chopped off.
I attach screeshots from the 3 widgetsets. I used the Dialogs component page because those icons have a distinctive color occupying the whole area.
I also reverted the commit setting DefaultDraw:=False. Default drawing is needed for the text. Only icon is drawn in the handler. On Windows the text was gone as expected, but with GTK2 or QT it made no difference which is another bug in those widgetsets.
IMO this is a valid way to draw icons in ListView also cross-platform, if only it works with all widgetsets. Conceptually it should be OK as the icon dimensions are known and there is no ambiquity.
The same concept is used in TreeView.
I'm pretty surprised by your comments. All OnCustomXXXX and OnAdvancedXXX are specialized events for Delphi. So if you expect that it can look on all platforms same like treeview then you're wrong. I've already have solution for that listview: OwnerDraw=TRUE and OnDrawItem() , that should look same on all platforms, just like treeview.
About alignment of text in Qt: I know about it, but couldn't find solution yet.
||Ok, I can try with OwnerDraw later.|
||I don't have enough spare time, but it's really not big deal. You have ownerdraw example in examples/listview. btw. you removed DefaultDraw, but look at the code what DefaultDraw does, and how ws eg. gtk2 or qt paints and why DefaultDraw is important.|
||We need good example project of such scenario, so then it will be probably fixed.|
||Qt text alignment is fixed in 47415|
||Gtk2 is still not polished.|
||Gtk2 should be fixed too. Please test and close if ok.|
||Looks good. Thanks Zeljko.|
|2014-11-14 18:31||Juha Manninen||New Issue|
|2014-11-14 18:31||Juha Manninen||Status||new => assigned|
|2014-11-14 18:31||Juha Manninen||Assigned To||=> Zeljan Rikalo|
|2014-11-14 18:46||Juha Manninen||Description Updated||View Revisions|
|2014-11-14 18:47||Juha Manninen||Description Updated||View Revisions|
|2014-11-15 08:38||Zeljan Rikalo||Relationship added||related to 0026770|
|2014-11-15 10:29||Zeljan Rikalo||Note Added: 0079158|
|2014-11-15 10:29||Zeljan Rikalo||Status||assigned => feedback|
|2014-11-15 11:14||Juha Manninen||Note Added: 0079159|
|2014-11-15 11:14||Juha Manninen||Status||feedback => assigned|
|2014-11-15 11:41||Zeljan Rikalo||Fixed in Revision||=> 46851,46853|
|2014-11-15 11:41||Zeljan Rikalo||Note Added: 0079160|
|2014-11-15 11:41||Zeljan Rikalo||Status||assigned => resolved|
|2014-11-15 11:41||Zeljan Rikalo||Resolution||open => fixed|
|2014-11-15 17:47||Juha Manninen||Note Added: 0079164|
|2014-11-15 17:47||Juha Manninen||Status||resolved => assigned|
|2014-11-15 17:47||Juha Manninen||Resolution||fixed => reopened|
|2014-11-15 17:48||Juha Manninen||Note Edited: 0079164||View Revisions|
|2014-11-15 17:53||Juha Manninen||Note Edited: 0079164||View Revisions|
|2014-11-15 17:55||Juha Manninen||File Added: Dialogs_Windows.png|
|2014-11-15 17:56||Juha Manninen||File Added: Dialogs_QT.png|
|2014-11-15 17:56||Juha Manninen||File Added: Dialogs_GTK2.png|
|2014-11-23 19:17||Zeljan Rikalo||Note Added: 0079315|
|2014-11-23 21:42||Juha Manninen||Note Added: 0079320|
|2014-11-24 08:57||Zeljan Rikalo||Note Added: 0079332|
|2014-12-04 09:18||Zeljan Rikalo||Note Added: 0079627|
|2015-01-18 17:52||Zeljan Rikalo||Fixed in Revision||46851,46853 => 46851,46853,47415|
|2015-01-18 17:52||Zeljan Rikalo||Note Added: 0080497|
|2015-01-18 17:52||Zeljan Rikalo||Status||assigned => resolved|
|2015-01-18 17:52||Zeljan Rikalo||Resolution||reopened => fixed|
|2015-01-18 17:53||Zeljan Rikalo||Note Added: 0080498|
|2015-01-18 17:53||Zeljan Rikalo||Status||resolved => confirmed|
|2015-01-18 21:11||Zeljan Rikalo||Fixed in Revision||46851,46853,47415 => 46851,46853,47415,47418|
|2015-01-18 21:11||Zeljan Rikalo||Note Added: 0080504|
|2015-01-18 21:11||Zeljan Rikalo||Status||confirmed => resolved|
|2015-02-01 09:13||Juha Manninen||Note Added: 0080706|
|2015-02-01 09:13||Juha Manninen||Status||resolved => closed|
|2015-05-30 00:51||Juha Manninen||Relationship added||related to 0028212|