How to make painter->drawText selectable and NOT editable
-
Hi
im using Listview item delegetor , and im drowing some texts in the items for example:
@QString videoTitle = pItem->title();
QRectF textBox = line.adjusted(PADDING+THUMB_WIDTH, PADDING, -2 * PADDING, -PADDING);
textBox = painter->boundingRect( textBox, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, videoTitle);
painter->drawText(textBox, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, videoTitle);
painter->setFont(smallerFont);@what i need to add so it will be selectable and NOT editable so i could copy it with my mouse .
-
Once you learn ow to use QAbstractItemDelegate class you will know about Its' memeber createEditor(),setEditorData(), and setModelData(). And then you will know how to create your own readonly QLineEdit Editor when select a item in your QAbstratItemView .