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

Accent palette role doesn't work in style sheets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.8.0
    • Widgets: Style Sheets
    • None
    • macOS

    Description

      The style sheet documentation lists "accent" as a valid palette role, but this doesn't seem to work. I guess if this is not expected to work, then the documentation should be adjusted. I also expected "placeholder-text" to work, although this isn't documented and much less useful.

      #include <QApplication>
      #include <QFormLayout>
      #include <QFrame>
      #include <QWidget>
      
      static const QStringList kNames = {
        "alternate-base",
        "accent",
        "base",
        "bright-text",
        "button",
        "button-text",
        "dark",
        "highlight",
        "highlighted-text",
        "light",
        "link",
        "link-visited",
        "mid",
        "midlight",
        "placeholder-text",
        "shadow",
        "text",
        "window",
        "window-text"
      };
      
      int main(int argc, char *argv[]) {
        QApplication app(argc, argv);
      
        QWidget window;
        QFormLayout *layout = new QFormLayout(&window);
        foreach (const QString &name, kNames) {
          QFrame *widget = new QFrame(&window);
          widget->setStyleSheet(
            QString("QFrame {background: palette(%1)}").arg(name));
          widget->setMinimumSize(32, 32);
          layout->addRow(name, widget);
        }
      
        window.show();
        return app.exec();
      }
      

      Attachments

        Issue Links

          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
              jasonhaslam Jason Haslam
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes