Results 1 to 3 of 3

Thread: Qtablewidget and selection color

  1. #1
    Join Date
    Sep 2011
    Posts
    51
    Thanks
    2
    Qt products
    Qt4

    Default Qtablewidget and selection color

    Hy all,
    i'm developing using old QT 4.2 and i've this question.
    I have a table ( Qtablewidget) and only some cells of a single row, have a different background color (red in my table), the other have the default background color.

    When i select the row i notice that the selected color override the cells color, but i need that the cells with different background (red in my table )remains with the old colour.

    Is there a way to do this ?

    Thanks in advance

  2. #2

    Default Re: Qtablewidget and selection color

    You have to use QStyledItemDelegate subclass and reimplement paint() function to establish a new behavior for QStyle::State_Selected option. Look at StarDelegate example closely.

  3. #3
    Join Date
    Sep 2011
    Posts
    51
    Thanks
    2
    Qt products
    Qt4

    Default Re: Qtablewidget and selection color

    I see but this example use QTableView...unifortunatly i've to use QTablewidget....
    Is there any example with Qtablewidget ?
    Thanks

    Gabriele

Similar Threads

  1. Any Color Selection Widget
    By grantbj74 in forum Newbie
    Replies: 1
    Last Post: 17th February 2012, 06:52
  2. Selection color for progressbar in treeview
    By Jennie Bystrom in forum Qt Programming
    Replies: 1
    Last Post: 11th February 2011, 17:32
  3. QPlainTextEdit selection color?
    By jajdoo in forum Newbie
    Replies: 3
    Last Post: 18th July 2010, 09:39
  4. Replies: 1
    Last Post: 22nd February 2010, 09:38
  5. Selection color
    By jnana in forum Qt Programming
    Replies: 1
    Last Post: 10th November 2006, 13:28

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.