Results 1 to 5 of 5

Thread: Incomplete text as tooltip in QTableWidget

  1. #1
    Join Date
    Apr 2013
    Posts
    64
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Incomplete text as tooltip in QTableWidget

    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?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Incomplete text as tooltip in QTableWidget

    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)
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Apr 2013
    Posts
    64
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Incomplete text as tooltip in QTableWidget

    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.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Incomplete text as tooltip in QTableWidget

    Call setToolTip() or setData() with the Qt::ToolTipRole on the QTableWidgetItem to set the string you would like displayed on the tooltip.

  5. The following user says thank you to ChrisW67 for this useful post:

    emobemo (25th June 2018)

  6. #5
    Join Date
    Apr 2013
    Posts
    64
    Thanks
    15
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Incomplete text as tooltip in QTableWidget

    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?

Similar Threads

  1. Replies: 1
    Last Post: 8th April 2011, 19:54
  2. Replies: 6
    Last Post: 28th March 2011, 18:53
  3. add text to qtablewidget
    By rashmi in forum Newbie
    Replies: 10
    Last Post: 7th December 2010, 09:09
  4. Replies: 4
    Last Post: 6th April 2010, 00:46
  5. Tooltip on QTableWidget header
    By ghorwin in forum Qt Programming
    Replies: 4
    Last Post: 29th October 2007, 09:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.