PDA

View Full Version : QListView / QListWidget and QItemDelegate Help



chrometix
16th January 2012, 04:01
So I'm trying to figure out how to work with the QItemDelegate in a QListWidget or QListView, and so far, I haven't had much luck finding a straightforward tutorial or guide explaining how to use these together.

I'm trying to create a couple color / style palettes, and I figure the best way is to utilize these two objects, rather than a QScrollArea with custom widgets placed in it. I will eventually store the colors in a palette, with the palette just being an array of my color objects (these will not just be colors, but objects storing a color, style, and a few other properties). I figure I can then generate the GUI version of the palette by using a few properties in the object.

Here are a couple wireframes of what I'm trying to accomplish - I want to have two versions of the palette:
7277

Honestly, I still cannot figure out how to use the QItemDelegate after reading numerous guides and posts and watching a few videos. Am I right about using a QListView, or should I stick with a QScrollArea for each area, and just create a new object for each item? Anyone have a bit of guidance for me?

Thanks

chrometix
17th January 2012, 02:11
After a bit more thought, I'm wondering if I should actually go for a QScrollArea with a custom object to directly paint onto it - I'll need to be able to manipulate each "item" in the list - left clicks, right clicks, a few tiny buttons on each that will handle their own clicks. I'll just have to do a bit of calculations when pai