PDA

View Full Version : Incomplete text as tooltip in QTableWidget



mqt
6th July 2013, 09:04
I have a QTableWidget with contents as double values. The values are sometimes bigger than the cell width available. I want a tool tip to appear with full text in that cell where mouse is. How to do this?

Santosh Reddy
6th July 2013, 10:13
I want a tool tip to appear with full text in that cell where mouse is. How to do this?
Do you want the full double value to be visible on tool tip? (when mouse is over the cell)
or
Do you want the full double value to be visible in the cell? (when mouse is over the cell)

mqt
6th July 2013, 14:06
The cell size is restricted to a specific size. If the value is 5.234, it will show fully without issue. But if the value is 5.234567, it will show as "5.2..." I don't want to reduce the text size or increase the cell size. What I want is that, when user keep mouse on the cells with dots because of space restriction, temporarily I want to show the full text. It can be on tool tip (or is there any other way?). How to do it on tool tip ? I thought this is a basic behavior of a table.

ChrisW67
7th July 2013, 00:28
Call setToolTip() or setData() with the Qt::ToolTipRole on the QTableWidgetItem to set the string you would like displayed on the tooltip.

mqt
7th July 2013, 04:32
This is a very common behavior of table cells or even any text fields to show complete text as a tool tip. I thought there would be some easy way to do that
If I do setToolTip(), I need to do that whenever I change the value in the cell. Right?