Results 1 to 3 of 3

Thread: how to change text color in QTableView?

  1. #1
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default how to change text color in QTableView?

    How do I change the color of the text within the QTableView using qt stylesheet?

    I have used following entry into my qss:
    QTableView
    {
    font-color : white;
    color : white;
    background-color: black;
    gridline-color: white;
    }

    but since the default text color is black, so nothing is visible. I want the text displayed within the QTableView to be displayed in white color. The above structure is not working.

    Please help.
    Last edited by phillip_Qt; 25th April 2008 at 15:09. Reason: to explian elaboratly
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

  2. #2
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Re: how to change text color in QTableView?

    I have no idea how to set the text color with stylesheets. But I use Qt::ItemDataRole (Qt::ForegroundRole) with setdata().

  3. #3
    Join Date
    Oct 2007
    Posts
    201
    Thanks
    19
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to change text color in QTableView?

    Quote Originally Posted by janus View Post
    I have no idea how to set the text color with stylesheets. But I use Qt::ItemDataRole (Qt::ForegroundRole) with setdata().
    But how to add in qss file? i tried like below, but its not working.

    QTableView
    {
    font-color : white;
    color : white;
    background-color: black;
    Foreground-color : white;
    }
    Cheers,
    Phillip



    --- Please post the solution you got to solve your problem. It may help others.

Similar Threads

  1. Graphics view display problem.
    By kiranraj in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2007, 07:08
  2. QTable - Data Base Problem
    By esq in forum Qt Tools
    Replies: 9
    Last Post: 27th May 2007, 23:08
  3. QTable - Date Base Problem
    By esq in forum Qt Programming
    Replies: 4
    Last Post: 23rd May 2007, 02:32
  4. graphics view FitInView problem
    By aamer4yu in forum Qt Programming
    Replies: 6
    Last Post: 25th January 2007, 10:24
  5. Problem with QTable
    By zlatko in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2006, 10:00

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.