Results 1 to 2 of 2

Thread: How to color a particular column which has pixmap in a QTableView

  1. #1
    Join Date
    Feb 2014
    Posts
    60
    Thanks
    4
    Thanked 5 Times in 5 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default How to color a particular column which has pixmap in a QTableView

    I have a custom table view class which has the structure such that the first and third columns are lineedit and second and third columns are buttons . I just want to color the text of the buttons even though when it is not selected . In delegate , Paint() method colors the 2nd and 4th columns as a pixmap not as a buttons so i want to color the text of a pixmap . Can any one help on it ?

  2. #2
    Join Date
    Jun 2015
    Location
    India
    Posts
    185
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to color a particular column which has pixmap in a QTableView

    Below code sets the fore ground color(text) to push button.
    You could try something like this.

    Qt Code:
    1. QPushButton *button = new QPushButton("Button");
    2. button->setPalette(*palette);
    3. QPalette* palette = new QPalette();
    4. palette->setColor(QPalette::ButtonText,Qt::red);
    To copy to clipboard, switch view to plain text mode 
    Thanks :-)

Similar Threads

  1. Replies: 1
    Last Post: 4th August 2015, 22:01
  2. Replies: 4
    Last Post: 27th February 2014, 09:42
  3. change pixmap color, clip background
    By Bocky in forum Qt Programming
    Replies: 1
    Last Post: 9th November 2013, 17:31
  4. QwtHistogramm one column color
    By denis821 in forum Qwt
    Replies: 2
    Last Post: 4th March 2013, 06:42
  5. QTableView Drag without pixmap
    By TheGrimace in forum Newbie
    Replies: 1
    Last Post: 18th June 2010, 18:19

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.