Does QToolButton have a 'RELEASED' signal?
I see these two, but no release.
self.snapshotBtn.pressed.connect(self.printMe)
self.snapshotBtn.triggered.connect(self.printMe)
self.snapshotBtn.pressed.connect(self.printMe)
self.snapshotBtn.triggered.connect(self.printMe)
To copy to clipboard, switch view to plain text mode
What I am trying to do is fire a signal when the user releases the QToolButton.
Ideas?
Please and Thanks,
Nick
My Test Code
import sys
try:
from PySide import QtCore, QtGui, QtGui as QtWidgets
except:
from PySide2 import QtCore, QtGui, QtWidgets
def __init__(self):
super(Example, self).__init__()
self.initUI()
def printMe(self):
print("thisWorks")
def initUI(self):
self.
snapshotMenu = QtWidgets.
QMenu() self.
captureAction = QtWidgets.
QAction("") #self.viewAction = QtWidgets.QAction("")
self.snapshotBtn.setObjectName("SnapShotButton")
#self.snapshotBtn.setIcon(QtGui.QIcon("C:/Users/nfran/.nuke/icons/cameraIcon.png"))
#self.viewAction.setIcon(QtGui.QIcon("C:/Users/nfran/.nuke/icons/cameraIcon.png"))
self.
captureAction.
setIcon(QtGui.
QIcon("C:/Users/nfran/.nuke/icons/cameraIcon.png"))
self.snapshotMenu.addAction(self.captureAction)
#self.snapshotMenu.addAction(self.viewAction)
self.snapshotBtn.setMenu(self.snapshotMenu)
self.snapshotBtn.move(50, 50)
self.snapshotMenu.setStyleSheet("""QMenu{ width: 30px; }""")
self.snapshotBtn.setStyleSheet("""#SnapShotButton {image: url(C:/Users/nfran/.nuke/icons/cameraIcon.png);} #SnapShotButton:hover {image: url(C:/Users/nfran/.nuke/icons/cameraIcon_Hover.png);}""")
self.snapshotBtn.pressed.connect(self.printMe)
self.snapshotBtn.triggered.connect(self.printMe)
self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('Tooltips')
self.show()
def main():
ex = Example()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
import sys
try:
from PySide import QtCore, QtGui, QtGui as QtWidgets
except:
from PySide2 import QtCore, QtGui, QtWidgets
class Example(QtWidgets.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def printMe(self):
print("thisWorks")
def initUI(self):
self.snapshotBtn = QtWidgets.QToolButton(self)
self.snapshotMenu = QtWidgets.QMenu()
self.captureAction = QtWidgets.QAction("")
#self.viewAction = QtWidgets.QAction("")
self.snapshotBtn.setObjectName("SnapShotButton")
#self.snapshotBtn.setIcon(QtGui.QIcon("C:/Users/nfran/.nuke/icons/cameraIcon.png"))
#self.viewAction.setIcon(QtGui.QIcon("C:/Users/nfran/.nuke/icons/cameraIcon.png"))
self.captureAction.setIcon(QtGui.QIcon("C:/Users/nfran/.nuke/icons/cameraIcon.png"))
self.snapshotMenu.addAction(self.captureAction)
#self.snapshotMenu.addAction(self.viewAction)
self.snapshotBtn.setMenu(self.snapshotMenu)
self.snapshotBtn.move(50, 50)
self.snapshotMenu.setStyleSheet("""QMenu{ width: 30px; }""")
self.snapshotBtn.setStyleSheet("""#SnapShotButton {image: url(C:/Users/nfran/.nuke/icons/cameraIcon.png);} #SnapShotButton:hover {image: url(C:/Users/nfran/.nuke/icons/cameraIcon_Hover.png);}""")
self.snapshotBtn.pressed.connect(self.printMe)
self.snapshotBtn.triggered.connect(self.printMe)
self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('Tooltips')
self.show()
def main():
app = QtWidgets.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
To copy to clipboard, switch view to plain text mode
Bookmarks