Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unexpected CSS behavior
Qt 6.11 is out! See what's new in the release blog

Unexpected CSS behavior

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.7k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

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

      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