PDA

View Full Version : QTableWidget + Icon



NoRulez
23rd July 2008, 14:37
Hey @all,

i have a QTableWidget with 5 Columns. Column 1, 3, 4, 5 were filled with data.
In Column 2 i would like to add 1 or more Statesymbols. With 1 Symbol there aren't any problems:


QIcon icon(":/images/symbol.png");
QTableWidgetItem *icon_item = new QTableWidgetItem;
icon_item->setIcon(icon);
icon_item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
table->setItem(row, col++, icon_item);


How can i add 2, 3 or more symbols after the other within 1 column?

Lg NoRulez

aamer4yu
23rd July 2008, 17:37
You may use delegates for that, and make the delegate draw the icons :)

NoRulez
23rd July 2008, 18:21
I don't know about delegates, can you give me an Example

Thanks
Kind Regards

NoRulez

ru_core
23rd July 2008, 18:29
I don't know about delegates, can you give me an Example

Thanks
Kind Regards

NoRulez

Demos And The Assistant is the best examples for you.
Try to look sideward Star Delegate Example ;)

Good luck