Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Hover stylesheet. PySide2
Forum Update on Tuesday, May 27th 2025

Hover stylesheet. PySide2

Scheduled Pinned Locked Moved Unsolved Qt for Python
pyside2
3 Posts 2 Posters 569 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.
  • C Offline
    C Offline
    Caeden
    wrote on 27 Sept 2021, 20:08 last edited by Caeden
    #1
            self.pushButton_30.setStyleSheet(u"""
            
    background-color: black;
    color: white;
    border:  2px solid rgb(166, 166, 166);
    border-radius: 4px;
    
    
    """)
    

    I have my stylesheet, but no matter the way I try and do hover it doesnt work-I've tried everything,

            self.pushButton_30.setStyleSheet(u"""
            
    ButtonThirty{
    background-color: black;
    color: white;
    border:  2px solid rgb(166, 166, 166);
    border-radius: 4px;
    }
    ButtonThirty:hover{
    color: black;
    }
    """)
    

    I've tried one colon, two colons, ive tried *:hover, can anyone help? Btw when I do the above it makes the entire button black (meaning it didnt parse it correctly, even when I put the color: white it still doesnt work. Anyone know?
    Edit:

    self.pushButton_30 = QPushButton(self.widget)
            self.pushButton_30.setObjectName(u"pushButton_30")
            self.pushButton_30.setGeometry(QRect(300, 160, 111, 51))
            self.pushButton_30.setStyleSheet(u"""
            
    background-color: black;
    color: white;
    border:  2px solid rgb(166, 166, 166);
    border-radius: 4px;
    
    
    """)
            self.pushButton_30.setAutoDefault(False)
    
    E 1 Reply Last reply 27 Sept 2021, 23:50
    0
    • C Caeden
      27 Sept 2021, 20:08
              self.pushButton_30.setStyleSheet(u"""
              
      background-color: black;
      color: white;
      border:  2px solid rgb(166, 166, 166);
      border-radius: 4px;
      
      
      """)
      

      I have my stylesheet, but no matter the way I try and do hover it doesnt work-I've tried everything,

              self.pushButton_30.setStyleSheet(u"""
              
      ButtonThirty{
      background-color: black;
      color: white;
      border:  2px solid rgb(166, 166, 166);
      border-radius: 4px;
      }
      ButtonThirty:hover{
      color: black;
      }
      """)
      

      I've tried one colon, two colons, ive tried *:hover, can anyone help? Btw when I do the above it makes the entire button black (meaning it didnt parse it correctly, even when I put the color: white it still doesnt work. Anyone know?
      Edit:

      self.pushButton_30 = QPushButton(self.widget)
              self.pushButton_30.setObjectName(u"pushButton_30")
              self.pushButton_30.setGeometry(QRect(300, 160, 111, 51))
              self.pushButton_30.setStyleSheet(u"""
              
      background-color: black;
      color: white;
      border:  2px solid rgb(166, 166, 166);
      border-radius: 4px;
      
      
      """)
              self.pushButton_30.setAutoDefault(False)
      
      E Offline
      E Offline
      eyllanesc
      wrote on 27 Sept 2021, 23:50 last edited by
      #2

      @Caeden try with: app.setStyle("fusion")

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Caeden
        wrote on 28 Sept 2021, 18:47 last edited by
        #3

        Okay thanks, I will try it

        1 Reply Last reply
        0

        1/3

        27 Sept 2021, 20:08

        • Login

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