本文整理汇总了Python中PyQt4.Qt.QToolButton.setDefaultAction方法的典型用法代码示例。如果您正苦于以下问题:Python QToolButton.setDefaultAction方法的具体用法?Python QToolButton.setDefaultAction怎么用?Python QToolButton.setDefaultAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QToolButton
的用法示例。
在下文中一共展示了QToolButton.setDefaultAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _createToolButtonWidget
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setDefaultAction [as 别名]
def _createToolButtonWidget(self, parent):
"""
@see: self.createWidget()
"""
btn = QToolButton(parent)
btn.setAutoFillBackground(True)
btn.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
btn.setMinimumWidth(75)
btn.setMaximumWidth(75)
btn.setMinimumHeight(62)
btn.setAutoRaise(True)
btn.setCheckable(True)
btn.setDefaultAction(self)
text = truncateText(self.text())
btn.setText(text)
if self._toolButtonPalette:
btn.setPalette(self._toolButtonPalette)
#@@@ ninad070125 The following function
#adds a newline character after each word in toolbutton text.
#but the changes are reflected only on 'mode' toolbuttons
#on the flyout toolbar (i.e.only Checkable buttons..don't know
#why. Disabling its use for now.
debug_wrapText = False
if debug_wrapText:
text = wrapToolButtonText(action.text())
if text:
action.setText(text)
return btn
示例2: StatusBar
# 需要导入模块: from PyQt4.Qt import QToolButton [as 别名]
# 或者: from PyQt4.Qt.QToolButton import setDefaultAction [as 别名]
class StatusBar(QStatusBar):
def __init__(self, win):
QStatusBar.__init__(self, win)
self.statusMsgLabel = QLabel()
self.statusMsgLabel.setMinimumWidth(200)
self.statusMsgLabel.setFrameStyle(QFrame.Panel | QFrame.Sunken)
self.addPermanentWidget(self.statusMsgLabel)
self.progressBar = QProgressBar(win)
self.progressBar.setMaximumWidth(250)
qt4todo("StatusBar.progressBar.setCenterIndicator(True)")
self.addPermanentWidget(self.progressBar)
self.progressBar.hide()
self.simAbortButton = QToolButton(win)
self.simAbortButton.setIcon(geticon("ui/actions/Simulation/Stopsign.png"))
self.simAbortButton.setMaximumWidth(32)
self.addPermanentWidget(self.simAbortButton)
self.connect(self.simAbortButton, SIGNAL("clicked()"), self.simAbort)
self.simAbortButton.hide()
self.dispbarLabel = QLabel(win)
# self.dispbarLabel.setFrameStyle( QFrame.Panel | QFrame.Sunken )
self.dispbarLabel.setText("Global display style:")
self.addPermanentWidget(self.dispbarLabel)
# Global display styles combobox
self.globalDisplayStylesComboBox = GlobalDisplayStylesComboBox(win)
self.addPermanentWidget(self.globalDisplayStylesComboBox)
# Selection lock button. It always displays the selection lock state
# and it is available to click.
self.selectionLockButton = QToolButton(win)
self.selectionLockButton.setDefaultAction(win.selectLockAction)
self.addPermanentWidget(self.selectionLockButton)
# Only use of this appears to be commented out in MWsemantics as of 2007/12/14
self.modebarLabel = QLabel(win)
self.addPermanentWidget(self.modebarLabel)
self.abortableCommands = {}
def makeCommandNameUnique(self, commandName):
index = 1
trial = commandName
while self.abortableCommands.has_key(trial):
trial = "%s [%d]" % (commandName, index)
index += 1
return trial
def addAbortableCommand(self, commandName, abortHandler):
uniqueCommandName = self.makeCommandNameUnique(commandName)
self.abortableCommands[uniqueCommandName] = abortHandler
return uniqueCommandName
def removeAbortableCommand(self, commandName):
del self.abortableCommands[commandName]
def simAbort(self):
"""
Slot for Abort button.
"""
if debug_flags.atom_debug and self.sim_abort_button_pressed: # bruce 060106
print "atom_debug: self.sim_abort_button_pressed is already True before we even put up our dialog"
# Added confirmation before aborting as part of fix to bug 915. Mark 050824.
# Bug 915 had to do with a problem if the user accidently hit the space bar or espace key,
# which would call this slot and abort the simulation. This should no longer be an issue here
# since we aren't using a dialog. I still like having this confirmation anyway.
# IMHO, it should be kept. Mark 060106.
ret = QMessageBox.warning(
self,
"Confirm",
"Please confirm you want to abort.\n",
"Confirm",
"Cancel",
"",
1, # The "default" button, when user presses Enter or Return (1 = Cancel)
1,
) # Escape (1= Cancel)
if ret == 0: # Confirmed
for abortHandler in self.abortableCommands.values():
abortHandler.pressed()
def show_indeterminate_progress(self):
value = self.progressBar.value()
self.progressBar.setValue(value)
def possibly_hide_progressbar_and_stop_button(self):
if len(self.abortableCommands) <= 0:
self.progressBar.reset()
self.progressBar.hide()
self.simAbortButton.hide()
def show_progressbar_and_stop_button(self, progressReporter, cmdname="<unknown command>", showElapsedTime=False):
"""
Display the statusbar's progressbar and stop button, and
update it based on calls to the progressReporter.
#.........这里部分代码省略.........