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

Flat QPushButton and style sheets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.15.0
    • Widgets: Style Sheets
    • None
    • Windows

    Description

      It is not possible to set the background color of a flat QPushButton using style sheets.

      Example:

       

      QPushButton* button = new QPushButton();
      button->setFlat(true);
      button->setStyleSheet("QPushButton:flat { background: yellow; }");

      The backgronud is set to yellow only when the button is pressed.

      If I remove the flat pseudo state in the style sheet, it does not change anything.

      But if I set the border to none, the background is set to yellow correctly:

      button->setStyleSheet("QPushButton:flat { background: yellow; border: none; }"); //OK 

       

      Attachments

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

        Activity

          People

            dorisverria Doris Verria
            puffosauro Fabio Dago
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes