PDA

View Full Version : insertion of multiple items in a single row



grimbaum
18th October 2006, 00:32
Hello all.

I having trouble to find a decent way to handle insertions of items.
I´m using a QTableView and a QStandardItemModel. My aim is to insert an icon and two strings inside one single cell .
I would like to arrange them like a list with the icon at top and the two strings under.
What would be the best solution to this?
Is it possible to insert a QListView inside a cell and fill that view with a QList?
perhaps not with something standard as QStandardItemModel:D .

I tried with itemDelegate and added a widget with some labels but with no luck otherwise this should do the trick I guess.

Another option that comes to mind is to somehow make like 3 rows inside this cell and setData to each row but it generates some other problems with index if it´s even possible.

thanks..

wysota
18th October 2006, 09:51
Take a look at QAbstractItemView::setIndexWidget() just remember it is not really suitable for data that gets modified. For those you should reimplement the delegate.

grimbaum
18th October 2006, 13:05
Ok I´ll take a look at it and I have no data who needs to be modified because I just want to display it once in the cell and that´s it.

thanks..

grimbaum
19th October 2006, 00:36
It worked out just fine. Since I use QTableView as table view and itself inherits QAbstractitem I could use setIndexWidget with my QTableVIew. When that thing solved I was able to insert QPixmap and some other strings. Again thanks a lot.

fusoin23
17th November 2006, 06:36
Can you post your code for how you used setIndexWidget? I'm having the hardest time figuring out where and how to use it?

Thanks so much.

-Kevin-