PDA

View Full Version : QTableWidget and setStyleSheet()



kazek3018
29th December 2008, 11:55
Hi.

If I select some cell in widget, then the header font start to be bold. I try to use setStyleSheet()

m_ui->InfoWidget->horizontalHeader()->setStyleSheet("font: normal;");

But it's not work. How to get normal font when some cell is select?

codeslicer
30th December 2008, 01:16
Hi,

The answer to your question can(and should) be found in the "Qt Style Sheets Reference" help page.

However, if it's not there, you may want to check help for QPalette.

Hope this helps,
codeslicer

codeslicer
30th December 2008, 01:24
Try this:


m_ui->InfoWidget->horizontalHeader()->setStyleSheet("QHorizontalHeaderItem:selected {font: normal;");

kazek3018
30th December 2008, 08:52
Thanks for replay, but is not working.

I tried before:

m_ui->InfoWidget->horizontalHeader()->setStyleSheet("QHeaderView {font: normal;}");
m_ui->InfoWidget->horizontalHeader()->setStyleSheet("QHeaderView::item {font: normal;}");
m_ui->InfoWidget->horizontalHeader()->setStyleSheet("QHeaderView::item:selected {font: normal;}");
m_ui->InfoWidget->horizontalHeader()->setStyleSheet("QHeaderView::section {font: normal;}");
m_ui->InfoWidget->horizontalHeader()->setStyleSheet("QHeaderView::section:selected {font: normal;}");

m_ui->InfoWidget->horizontalHeader()->setStyleSheet("section {font: normal;}");
m_ui->InfoWidget->horizontalHeader()->setStyleSheet("section:selected {font: normal;}");
m_ui->InfoWidget->horizontalHeader()->setStyleSheet("item {font: normal;}");
m_ui->InfoWidget->horizontalHeader()->setStyleSheet("item:selected {font: normal;}");

And it's not working, but this one is working:

m_ui->InfoWidget->horizontalHeader()->setStyleSheet("QHeaderView {background-color: lime;}");

For QPalette --> I don't see any property for font, only text color, HighlightedText etc.