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

Flat QPushButton and style sheets

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P4: Low
    • Resolution: Unresolved
    • Affects Version/s: 5.15.0
    • Fix Version/s: None
    • Component/s: Widgets: Style Sheets
    • Labels:
      None
    • Platform/s:
      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

            Assignee:
            dorisverria Doris Verria
            Reporter:
            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