本文整理汇总了Python中PyQt4.QtGui.QActionGroup方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QActionGroup方法的具体用法?Python QtGui.QActionGroup怎么用?Python QtGui.QActionGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QActionGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupMenuSmoothing
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QActionGroup [as 别名]
def setupMenuSmoothing(self):
# unfortunately Qt Designer doesn't support QActionGroup, we have to code it up
self.uiMenuSmoothingGroup = QtGui.QActionGroup(self.uiSmoothingMenu, exclusive=True)
def onSmoothingToggled(boolean):
if boolean:
result = re.search(r'[0-9]+', self.sender().text())
if result:
Settings.setValue(Settings.SMOOTHING, result.group(0))
desc = defaultdictinit({0: ' More jerky', 1: ' Default', 10: ' Laggy'})
for smooth in range(11):
act = QtGui.QAction('&' + str(smooth) + desc[smooth], self)
act.setCheckable(True)
act.toggled.connect(onSmoothingToggled)
self.uiSmoothingMenu.addAction(self.uiMenuSmoothingGroup.addAction(act))
cleanname = self.buildInSmoothingToActionName(smooth)
setattr(self, cleanname, act)
示例2: setupMenuTheme
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QActionGroup [as 别名]
def setupMenuTheme(self):
# unfortunately Qt Designer doesn't support QActionGroup, we have to code it up
actionTitleShortcuts = set()
def actionTitle(title):
shortcutFound = False
ret = ''
for c in title:
l = c.lower()
if not shortcutFound and l in 'abcdefghijklmnopqrstuvwxy' and l not in actionTitleShortcuts:
ret += '&'
actionTitleShortcuts.add(l)
shortcutFound = True
ret += c
return ret
self.uiMenuThemeGroup = QtGui.QActionGroup(self.uiThemeMenu, exclusive=True)
self.uiDarkThemeAct = QtGui.QAction(actionTitle("Dark Orange"), self)
self.uiDarkThemeAct.setCheckable(True)
self.uiDarkThemeAct.toggled.connect(ColorTheme.setDarkTheme)
self.uiThemeMenu.addAction(self.uiMenuThemeGroup.addAction(self.uiDarkThemeAct))
for k in QtGui.QStyleFactory.keys():
act = QtGui.QAction(actionTitle(k), self)
act.setCheckable(True)
act.toggled.connect(self.setStyleCallback(k))
self.uiThemeMenu.addAction(self.uiMenuThemeGroup.addAction(act))
cleanname = self.buildInStyleToActionName(k)
setattr(self, cleanname, act)
self.uiCustomQssFileAct = QtGui.QAction(actionTitle("Custom Qss stylesheet"), self)
self.uiCustomQssFileAct.triggered.connect(self.setCustomQss)
self.uiThemeMenu.addAction(self.uiCustomQssFileAct)