Unexpected CSS behavior

  • 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?

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

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.