本文整理汇总了Python中PySide.QtGui.QAction.toggle方法的典型用法代码示例。如果您正苦于以下问题:Python QAction.toggle方法的具体用法?Python QAction.toggle怎么用?Python QAction.toggle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QAction
的用法示例。
在下文中一共展示了QAction.toggle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handleEvents
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import toggle [as 别名]
def handleEvents(self, event, signals):
att = self.axisOrder[self.findAxisIndex(event.x)]
# context menu
if event.contextRequested:
contextMenu = QMenu(self)
contextMenu.addAction(u'Select all')
contextMenu.addAction(u'Select none')
contextMenu.addSeparator()
act = QAction(u'Hide Axis', self)
contextMenu.addAction(act)
if len(self.axisOrder) <= 1:
act.setEnabled(False)
axesMenu = QMenu(u'Show/Hide Axes', self)
axesActions = QActionGroup(self)
for a in self.axisOrder:
act = QAction(a,self,checkable=True)
if self.axes[a].visible:
act.toggle()
if len(self.axisOrder) <= 1:
act.setEnabled(False)
axesActions.addAction(act)
for act in axesActions.actions():
axesMenu.addAction(act)
contextMenu.addMenu(axesMenu)
contextMenu.addSeparator()
contextMenu.addAction(u'Use as X axis')
contextMenu.addAction(u'Use as Y axis')
resultAction = contextMenu.exec_(QCursor.pos())
if resultAction != None and resultAction != 0:
# Select all
if resultAction.text() == u'Select all':
self.app.intMan.newOperation(operation.ALL,att=att.dataAxis)
# Select none
if resultAction.text() == u'Select none':
self.app.intMan.newOperation(operation.NONE,att=att.dataAxis)
# Hide axis
if resultAction.text() == u'Hide Axis':
self.toggleVisible(att)
# Toggle axis
if resultAction.actionGroup() == axesActions:
self.toggleVisible(resultAction.text())
# X axis
if resultAction.text() == u'Use as X axis':
if self.app.currentYattribute != self.app.currentXattribute:
self.axes[self.app.currentXattribute].visAxis.handle.background.setAttribute('fill',self.normalHandleColor)
self.axes[self.app.currentXattribute].visAxis.handle.originalBackgroundColor = self.normalHandleColor
self.axes[att].visAxis.handle.background.setAttribute('fill',self.activeHandleColor)
self.axes[att].visAxis.handle.originalBackgroundColor = self.activeHandleColor
self.app.notifyAxisChange(att,xAxis=True)
# Y axis
if resultAction.text() == u'Use as Y axis':
if self.app.currentXattribute != self.app.currentYattribute:
self.axes[self.app.currentYattribute].visAxis.handle.background.setAttribute('fill',self.normalHandleColor)
self.axes[self.app.currentYattribute].visAxis.handle.originalBackgroundColor = self.normalHandleColor
self.axes[att].visAxis.handle.background.setAttribute('fill',self.activeHandleColor)
self.axes[att].visAxis.handle.originalBackgroundColor = self.activeHandleColor
self.app.notifyAxisChange(att,xAxis=False)
#if linesMoved:
# self.highlightedLayer.refreshLines(self.app.highlightedRsNumbers)
return signals