Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QPushButton:pressed not applied if stylesheet on parent
Qt 6.11 is out! See what's new in the release blog

QPushButton:pressed not applied if stylesheet on parent

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ruan
    wrote on last edited by
    #1

    Hi,

    So I'm having troubles with stylesheets. I want to change the background of a button if it's pressed.
    When I put the qss for QPushButton:pressed on the button itself everything works fine, but if I put it on the QMainWindow or another parent of the button(s), it doesn't work and the background color just stays the same when it is pressed.

    Any ideas how I could make this work or is it a bug?

    Note: hover works when applied through the main windows' stylesheet.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Ruan
      wrote on last edited by
      #2

      Hi, I figured it out myself...
      If i put the pressed qss after the hover qss everything works as expected. Seems like the hover color just stays there if it's the latest entry in the stylesheet.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved