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

Wrong background for transient scrollbars

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.3.2
    • 5.3.1
    • Widgets: Style Sheets
    • None
    • OS X (QMacStyle) and Windows & Linux (QFusionStyle)
    • qtbase#5.3: 5de4ed9db38c7a1a480e5979c2bb3b0340c8a230

    Description

      Whether the background color is light or dark is tested from QScrollBar's palette, whereas it should be tested from QAbstractScrollArea's palette when feasible.

      #include <QtWidgets>
      
      class ProxyStyle : public QProxyStyle
      {
      public:
          ProxyStyle() : QProxyStyle(QStyleFactory::create("fusion")) { }
          int styleHint(StyleHint h, const QStyleOption *o = 0, const QWidget *w = 0, QStyleHintReturn *d = 0) const
          {
              if (h == QStyle::SH_ScrollBar_Transient)
                  return 1;
              return QProxyStyle::styleHint(h, o, w, d);
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      #ifndef Q_OS_MAC
          app.setStyle(new ProxyStyle);
      #endif
          QTextEdit ta;
          ta.setStyleSheet("QTextEdit { color: #eee; background: #333; }");
          for (int i = 0; i < 200; ++i)
              ta.append(QString::number(i));
          ta.show();
          return app.exec();
      }
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            jpnurmi J-P Nurmi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes