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
Qt 6.11 is out! See what's new in the release blog

Hover stylesheet. PySide2

Scheduled Pinned Locked Moved Unsolved Qt for Python
pyside2
3 Posts 2 Posters 908 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 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)
    
    eyllanescE 1 Reply Last reply
    0
    • C Caeden
              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)
      
      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on 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 last edited by
        #3

        Okay thanks, I will try it

        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