PDA

View Full Version : Something like placeholderText in QTableWidgetItem?



dobedidoo
9th June 2016, 19:29
Hi,

I wonder if there is some way to set a functionality similar to the placeholderText currently available in QLineEdit, QTextEdit (and possibly some others) but instead in a QTableWidgetItem (here called a 'cell'). I could set a QLineEdit as the item widget in the cell, and set placeholderText in that QLineEdit, but this is not a possible solution for me since that changes also other behaviours of the cell.

So, is it possible to set some "placeholder text" (only visible, neither selectable nor editable by the user (not meaning "read only")) in the cell whenever the cell text is in fact empty, in the same way as placeholderText for QLineEdit?

Thanks in advance!

/d

anda_skoa
9th June 2016, 20:03
You could try setting that as the item's text if there is no actual value and at the same time setting the Qt::EditRole data to the cell's base value.

Cheers,
_