本文整理匯總了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)