Hi and thank you for the answer. I'm quite new in this game, and have to ask a bit more.
Set the whole text by using QTableWidgetItem::setData() with Qt::UserRole.
Is this the correct way to do the above mentioned?
// Label for trimmed text
item->setData(Qt::TextDontPrint, v.toString());
// assume a table is available through the pointer tw
tw->setCellWidget(row, column, label);
tw->setItem(row, column, item);
QString s = "Some text";
// Label for trimmed text
QLabel* label = new QLabel(s.section(" ", 0, 0));
QVariant v = QVariant(s);
QTableWidgetItem* item = new QTableWidgetItem();
item->setData(Qt::TextDontPrint, v.toString());
// assume a table is available through the pointer tw
tw->setCellWidget(row, column, label);
tw->setItem(row, column, item);
To copy to clipboard, switch view to plain text mode
And then this part:
Get the text back via QTableWidgetItem::data().
.
If I've got a pointer to a TableWidgetItem, twi, how can I make the text visible again?
QString s
= twi
->data
(some role
).
toString();
QString s = twi->data(some role).toString();
To copy to clipboard, switch view to plain text mode
Not sure about roles.
Regards,
André
Bookmarks