Results 1 to 2 of 2

Thread: Something like placeholderText in QTableWidgetItem?

  1. #1
    Join Date
    Nov 2009
    Location
    Sweden
    Posts
    34
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Something like placeholderText in QTableWidgetItem?

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Something like placeholderText in QTableWidgetItem?

    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,
    _

Similar Threads

  1. How to set the PlaceHolderText for a TextEdit?
    By JavidRoshan in forum Qt Programming
    Replies: 4
    Last Post: 20th November 2012, 23:20
  2. How to set the PlaceHolderText for a TextEdit?
    By JavidRoshan in forum Newbie
    Replies: 1
    Last Post: 20th November 2012, 00:56
  3. QTableWidgetItem
    By weixj2003ld in forum Qt Programming
    Replies: 1
    Last Post: 11th August 2011, 07:35
  4. QTableWidgetItem
    By weixj2003ld in forum Qt Programming
    Replies: 3
    Last Post: 7th August 2011, 08:59
  5. QTableWidgetItem for a QTableWidget
    By Archa4 in forum Newbie
    Replies: 1
    Last Post: 28th April 2011, 12:11

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.