Jump to content
junvfx

pyside2 QPushButton mousePressEvent

Recommended Posts

hi, everyone。Look at my problem. I use pyside2  create  UI  in  houdini. 

image.png.6ab7ae979c970cf98fe813ed7f75a81e.png

when I click button B ,  print info and button B shape have change

when I click button A,   print info but  button A shape not have change 

please help

 

 

pyside2_test.py

Share this post


Link to post
Share on other sites

solved it

add setDown 

    def mousePressEvent(self, event):
        self.setDown(True)

        print "button A"

    def mouseReleaseEvent(self, event):
        self.setDown(False)

 

Share this post


Link to post
Share on other sites

Here's a simpler way:

QPushButton.setCheckable(True)

QPushButton.isCheked()

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×