本文整理汇总了Python中python_qt_binding.QtGui.QVBoxLayout.totalMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.totalMinimumSize方法的具体用法?Python QVBoxLayout.totalMinimumSize怎么用?Python QVBoxLayout.totalMinimumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类python_qt_binding.QtGui.QVBoxLayout
的用法示例。
在下文中一共展示了QVBoxLayout.totalMinimumSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MessageBox
# 需要导入模块: from python_qt_binding.QtGui import QVBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QVBoxLayout import totalMinimumSize [as 别名]
#.........这里部分代码省略.........
self.verticalLayout.addWidget(self.textEdit)
self.resize(480, self.verticalLayout.totalSizeHint().height())
buttons_in_box = self.buttonBox.buttons()
if buttons_in_box:
self.buttonBox.buttons()[0].setFocus()
def setAcceptButton(self, button):
'''
Sets the button with given ID to accept button if more then one button with AcceptRole was added to this dialog.
Adds the buttton to the box if is not already in.
:param button: int
'''
if not button & self._buttons:
self._create_buttons(button)
self._accept_button = button
def setRejectButton(self, button):
'''
Sets the button with given ID to reject button if more then one button with RejectRole was added to this dialog.
Adds the buttton to the box if is not already in.
:param button: int
'''
if not button & self._buttons:
self._create_buttons(button)
self._reject_button = button
def on_toggled_details(self, checked):
if checked:
self.verticalLayout.addWidget(self.textEdit)
else:
self.verticalLayout.removeWidget(self.textEdit)
self.textEdit.setVisible(checked)
if not self.isMaximized():
self.setMinimumSize(self.verticalLayout.totalMinimumSize())
self.resize(self._current_size.width(), self.verticalLayout.totalSizeHint().height())
@staticmethod
def about(parent, title, text, detailed_text='', buttons=Close):
box = MessageBox(MessageBox.Information, title, text, detailed_text=detailed_text, buttons=buttons, parent=parent)
if MessageBox.Yes & buttons:
box.setAcceptButton(MessageBox.Yes)
if MessageBox.Cancel & buttons:
box.setRejectButton(MessageBox.Cancel)
elif MessageBox.No & buttons:
box.setRejectButton(MessageBox.No)
return box.exec_()
@staticmethod
def information(parent, title, text, detailed_text='', buttons=Close):
box = MessageBox(MessageBox.Information, title, text, detailed_text=detailed_text, buttons=buttons, parent=parent)
if MessageBox.Yes & buttons:
box.setAcceptButton(MessageBox.Yes)
if MessageBox.Cancel & buttons:
box.setRejectButton(MessageBox.Cancel)
elif MessageBox.No & buttons:
box.setRejectButton(MessageBox.No)
return box.exec_()
@staticmethod
def question(parent, title, text, detailed_text='', buttons=Yes | No | Cancel):
box = MessageBox(MessageBox.Question, title, text, detailed_text=detailed_text, buttons=buttons, parent=parent)
if MessageBox.Yes & buttons:
box.setAcceptButton(MessageBox.Yes)
if MessageBox.Cancel & buttons:
box.setRejectButton(MessageBox.Cancel)
elif MessageBox.No & buttons: