Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unexpected CSS behavior

    General and Desktop
    1
    2
    1274
    Loading More Posts
    • 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.
    • E
      Endless last edited by

      I'm using the following stylesheet for one of my classes:
      @
      setStyleSheet("QPushButton { background: qradialgradient(cx: 0, cy: 0, radius: 0.8, fx: 0.5, fy: 0.5,"
      "stop: 0 #00FFFF, stop: 1 #0099FF); border: 1px solid #000000; border-radius: 6px; }"
      "QPushButton#submitButton, QPushButton#cancelButton, QPushButton#downloadButton,"
      "QPushButton#printButton, QPushButton#uploadButton, QPushButton#monitorButton,"
      "QPushButton#define1Button, QPushButton#define2Button { background-color: #E0E0E0;"
      "border: 2px solid #000000; border-radius: 7px; }"
      "QPushButton:pressed { background-color: #FFFFFF; }"
      );
      @

      There's a list of specific buttons (submitButton, cancelButton, etc.) that have a relatively simple look, but all of the rest of the buttons use qradialgradient. I'd like the background color of all the buttons to turn to white (#FFFFFF) when they're clicked, but only the QPushButtons that are not specifically named do this. The ones that are specifically named don't change appearance. What am I doing wrong?

      1 Reply Last reply Reply Quote 0
      • E
        Endless last edited by

        Sorry it looks so sloppy - I clicked Preview, and everything looked great. Obviously the actual post is different.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post