Okay, I see your point but I want the icon to span the 2 rows, can I do it using Grid Layout?
Moreover, do you know how I can insert my custom widget into my ListView?
Thanks.
Okay, I see your point but I want the icon to span the 2 rows, can I do it using Grid Layout?
Moreover, do you know how I can insert my custom widget into my ListView?
Thanks.
Sure. Read documentation for QGridLayoutbut I want the icon to span the 2 rows, can I do it using Grid Layout?
Why do you want to use ListView ? inserting custom widget is heavy and should not be done for many cells..
Whats your requirement ?
What I want is to build a list. The problem is that it is not a basic list.
Every element of this list must be composed of the layout previously described (some text on the left, in the middle and an icon on the right)
This is how a single element of the list should look like:
| text here ################################ text here ### ICON |
| other text here (might be in different style) ##### text here ### ICON |
The ICON spans the 2 rows.
So my idea was to build a widget representing a single element of the list and then add several widgets to the list.
Please tell me if something is still not clear.
Thanks again.
It would be better if you go for delegates then. See QItemDelegateIn the paint function you can calculate the rects yourself and draw text and place icons as per your requirement.
Other ways wont be as efficient as using delegates. Also see setItemData with which you can set different text you need..
Bookmarks