Results 1 to 4 of 4

Thread: QTableWidget and setStyleSheet()

  1. #1
    Join Date
    Dec 2008
    Posts
    13
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QTableWidget and setStyleSheet()

    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?

  2. #2
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Arrow Re: QTableWidget and setStyleSheet()

    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

  3. #3
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget and setStyleSheet()

    Try this:

    Qt Code:
    1. m_ui->InfoWidget->horizontalHeader()->setStyleSheet("QHorizontalHeaderItem:selected {font: normal;");
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Dec 2008
    Posts
    13
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget and setStyleSheet()

    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.
    Last edited by kazek3018; 30th December 2008 at 08:59.

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.