Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-112467

StyleSheet for QTableWidget does not work properly for certain widgets in 5.15.x

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • None
    • 5.15.13
    • Widgets: Style Sheets
    • None
    • Windows

    Description

      Please run the attached reproducer on both 5.15.x and 6.4.x to see the difference. In 5.15.x, headers, scrollbars and corner button are not styled at all, while everything works out just fine in 6.4.x.

      In 5.15.x, one has to explicitly set stylesheet for each single component in QTableWidget (as well as the QTableWidget itself) to get everything uniformly styled, such as:
      ui->TableWidgetName->horizontalHeader()->setStyleSheet()
      ui->TableWidgetName->horizontalScrollBar()->setStyleSheet()
      ui->TableWidgetName->setStyleSheet()

      And the corner button - somehow only styling QTableCornerButton in stylesheet for QTableWidget doesn't work. One has to also use:
      QAbstractButton* btn = ui->TableWidgetName->findChild<QAbstractButton*>();
      to access this private button and set stylesheet for it.

      How to use reproducer:
      1. Run the project in 5.15.x
      2. Click either 'Schedule Editor' or 'Fanuc Mem' to see the issue
      3. Switch to 6.4.x to see the difference

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            luqiaochen Luqiao Chen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes