本文整理汇总了Python中python_qt_binding.QtGui.QPushButton.setVisible方法的典型用法代码示例。如果您正苦于以下问题:Python QPushButton.setVisible方法的具体用法?Python QPushButton.setVisible怎么用?Python QPushButton.setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类python_qt_binding.QtGui.QPushButton
的用法示例。
在下文中一共展示了QPushButton.setVisible方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WarningMessageBox
# 需要导入模块: from python_qt_binding.QtGui import QPushButton [as 别名]
# 或者: from python_qt_binding.QtGui.QPushButton import setVisible [as 别名]
class WarningMessageBox(QMessageBox):
def __init__(self, icon, title, text, detailed_text="", buttons=QMessageBox.Ok):
QMessageBox.__init__(self, icon, title, text, buttons)
if detailed_text:
self.setDetailedText(detailed_text)
horizontalSpacer = QSpacerItem(480, 0, QSizePolicy.Minimum, QSizePolicy.Expanding)
layout = self.layout()
layout.addItem(horizontalSpacer, layout.rowCount(), 0, 1, layout.columnCount())
if QMessageBox.Abort & buttons:
self.setEscapeButton(QMessageBox.Abort)
elif QMessageBox.Ignore & buttons:
self.setEscapeButton(QMessageBox.Ignore)
else:
self.setEscapeButton(buttons)
self.textEdit = textEdit = self.findChild(QTextEdit)
if textEdit is not None:
textEdit.setMinimumHeight(0)
textEdit.setMaximumHeight(600)
textEdit.setMinimumWidth(0)
textEdit.setMaximumWidth(600)
textEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.ignore_all_btn = QPushButton('Don\'t display again')
self.addButton(self.ignore_all_btn, QMessageBox.HelpRole)
def paintEvent(self, event):
QMessageBox.paintEvent(self, event)
self.ignore_all_btn.setVisible(self.textEdit.isVisible() if self.textEdit else False)