PDA

View Full Version : how to change text color in QTableView?



phillip_Qt
25th April 2008, 15:00
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.

janus
26th April 2008, 10:54
I have no idea how to set the text color with stylesheets. But I use Qt::ItemDataRole (Qt::ForegroundRole) with setdata().

phillip_Qt
28th April 2008, 10:03
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;
}