本文整理汇总了Python中python_qt_binding.QtGui.QVBoxLayout.addItem方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.addItem方法的具体用法?Python QVBoxLayout.addItem怎么用?Python QVBoxLayout.addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类python_qt_binding.QtGui.QVBoxLayout
的用法示例。
在下文中一共展示了QVBoxLayout.addItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from python_qt_binding.QtGui import QVBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QVBoxLayout import addItem [as 别名]
def __init__(self, masteruri, cfg, ns, nodes, parent=None):
QFrame.__init__(self, parent)
self._masteruri = masteruri
self._nodes = {cfg: {ns: nodes}}
frame_layout = QVBoxLayout(self)
frame_layout.setContentsMargins(0, 0, 0, 0)
# create frame for warning label
self.warning_frame = warning_frame = QFrame(self)
warning_layout = QHBoxLayout(warning_frame)
warning_layout.setContentsMargins(0, 0, 0, 0)
warning_layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
self.warning_label = QLabel()
icon = QIcon(':/icons/crystal_clear_warning.png')
self.warning_label.setPixmap(icon.pixmap(QSize(40, 40)))
self.warning_label.setToolTip('Multiple configuration for same node found!\nA first one will be selected for the start a node!')
warning_layout.addWidget(self.warning_label)
warning_layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
frame_layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
frame_layout.addWidget(warning_frame)
# create frame for start/stop buttons
buttons_frame = QFrame()
buttons_layout = QHBoxLayout(buttons_frame)
buttons_layout.setContentsMargins(0, 0, 0, 0)
buttons_layout.addItem(QSpacerItem(20, 20))
self.on_button = QPushButton()
self.on_button.setFlat(False)
self.on_button.setText("On")
self.on_button.clicked.connect(self.on_on_clicked)
buttons_layout.addWidget(self.on_button)
self.off_button = QPushButton()
self.off_button.setFlat(True)
self.off_button.setText("Off")
self.off_button.clicked.connect(self.on_off_clicked)
buttons_layout.addWidget(self.off_button)
buttons_layout.addItem(QSpacerItem(20, 20))
frame_layout.addWidget(buttons_frame)
frame_layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding))
self.warning_frame.setVisible(False)
示例2: SelectDialog
# 需要导入模块: from python_qt_binding.QtGui import QVBoxLayout [as 别名]
# 或者: from python_qt_binding.QtGui.QVBoxLayout import addItem [as 别名]
class SelectDialog(QDialog):
'''
This dialog creates an input mask for a string list and return selected entries.
'''
def __init__(self, items=list(), buttons=QDialogButtonBox.Cancel | QDialogButtonBox.Ok, exclusive=False,
preselect_all=False, title='', description='', icon='', parent=None, select_if_single=True,
checkitem1='', checkitem2=''):
'''
Creates an input dialog.
@param items: a list with strings
@type items: C{list()}
'''
QDialog.__init__(self, parent=parent)
self.setObjectName(' - '.join(['SelectDialog', str(items)]))
self.verticalLayout = QVBoxLayout(self)
self.verticalLayout.setObjectName("verticalLayout")
self.verticalLayout.setContentsMargins(1, 1, 1, 1)
# add filter row
self.filter_frame = QFrame(self)
filterLayout = QHBoxLayout(self.filter_frame)
filterLayout.setContentsMargins(1, 1, 1, 1)
label = QLabel("Filter:", self.filter_frame)
self.filter_field = EnchancedLineEdit(self.filter_frame)
filterLayout.addWidget(label)
filterLayout.addWidget(self.filter_field)
self.filter_field.textChanged.connect(self._on_filter_changed)
self.verticalLayout.addWidget(self.filter_frame)
if description:
self.description_frame = QFrame(self)
descriptionLayout = QHBoxLayout(self.description_frame)
# descriptionLayout.setContentsMargins(1, 1, 1, 1)
if icon:
self.icon_label = QLabel(self.description_frame)
self.icon_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
self.icon_label.setPixmap(QPixmap(icon).scaled(30, 30, Qt.KeepAspectRatio))
descriptionLayout.addWidget(self.icon_label)
self.description_label = QLabel(self.description_frame)
self.description_label.setWordWrap(True)
self.description_label.setText(description)
descriptionLayout.addWidget(self.description_label)
self.verticalLayout.addWidget(self.description_frame)
# create area for the parameter
self.content = MainBox(self)
if items:
self.scroll_area = QScrollArea(self)
self.scroll_area.setFocusPolicy(Qt.NoFocus)
self.scroll_area.setObjectName("scroll_area")
self.scroll_area.setWidgetResizable(True)
self.scroll_area.setWidget(self.content)
self.verticalLayout.addWidget(self.scroll_area)
self.checkitem1 = checkitem1
self.checkitem1_result = False
self.checkitem2 = checkitem2
self.checkitem2_result = False
# add select all option
if not exclusive and items:
self._ignore_next_toggle = False
self.select_all_checkbox = QCheckBox('all entries')
self.select_all_checkbox.setTristate(True)
self.select_all_checkbox.stateChanged.connect(self._on_select_all_checkbox_stateChanged)
self.verticalLayout.addWidget(self.select_all_checkbox)
self.content.toggled.connect(self._on_main_toggle)
if self.checkitem1:
self.checkitem1_checkbox = QCheckBox(self.checkitem1)
self.checkitem1_checkbox.stateChanged.connect(self._on_select_checkitem1_checkbox_stateChanged)
self.verticalLayout.addWidget(self.checkitem1_checkbox)
if self.checkitem2:
self.checkitem2_checkbox = QCheckBox(self.checkitem2)
self.checkitem2_checkbox.stateChanged.connect(self._on_select_checkitem2_checkbox_stateChanged)
self.verticalLayout.addWidget(self.checkitem2_checkbox)
if not items:
spacerItem = QSpacerItem(1, 1, QSizePolicy.Expanding, QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
# create buttons
self.buttonBox = QDialogButtonBox(self)
self.buttonBox.setObjectName("buttonBox")
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(buttons)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
self.verticalLayout.addWidget(self.buttonBox)
# set the input fields
if items:
self.content.createFieldsFromValues(items, exclusive)
if (select_if_single and len(items) == 1) or preselect_all:
self.select_all_checkbox.setCheckState(Qt.Checked)
if not items or len(items) < 7:
self.filter_frame.setVisible(False)
# print '=============== create', self.objectName()
#
#.........这里部分代码省略.........