Oh wow, I was looking in another direction entirely. This looks more
interesting though. Thanks for sharing this because I would not have
figured this out at all. I tend to stick to the pre-packaged events and
setups, and rarely roll anything really original.
-Tim
On 7/9/2014 5:39 PM, Jon Swindells wrote:
no idea how it would handle inside maya but, this should get you started:
/code
from PySide import QtGui, QtCore
class XSITypeMenuThing(QtCore.QObject):
def eventFilter(self, obj, event):
mods = QtGui.QApplication.keyboardModifiers()
if mods == QtCore.Qt.ShiftModifier:
if event.type() in [QtCore.QEvent.MouseButtonRelease] and
isinstance(obj, QtGui.QMenu):
if obj.activeAction() and not obj.activeAction().menu():
obj.activeAction().trigger()
return True
return super(XSITypeMenuThing, self).eventFilter(obj, event)
if __name__ == '__main__':
app = QtGui.QApplication([])
window = QtGui.QMainWindow()
menu = QtGui.QMenu("menu", window)
fil = XSITypeMenuThing()
menu.installEventFilter(fil)
menu.addAction(QtGui.QAction('You', menu, checkable=True))
menu.addAction(QtGui.QAction('Will', menu, checkable=True))
menu.addAction(QtGui.QAction('Need', menu, checkable=True))
menu.addAction(QtGui.QAction('To', menu, checkable=True))
menu.addAction(QtGui.QAction('Send', menu, checkable=True))
menu.addAction(QtGui.QAction('Me', menu, checkable=True))
menu.addAction(QtGui.QAction('Money', menu, checkable=True))
window.menuBar().addMenu(menu)
window.show()
app.exec_()
--
Jon Swindells
jon_swinde...@fastmail.fm
On Wed, Jul 9, 2014, at 07:10 PM, Tim Crowson wrote:
I'm asking this here because XSI users will immediately know the
behavior I'm trying to emulate. I want to recreate Soft's menu
behavior whereby shift-clicking on a menu item will check/uncheck it,
but keep the menu open and let you click on other entries as well. Is
this behavior reproducible in PySide/PyQt, if so how? I'm searching
around now, but wanted to drop a line here too.
-- Tim Crowson
--
Signature