本文整理汇总了Python中PyQt5.QtWidgets.QBoxLayout.addItem方法的典型用法代码示例。如果您正苦于以下问题:Python QBoxLayout.addItem方法的具体用法?Python QBoxLayout.addItem怎么用?Python QBoxLayout.addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QBoxLayout
的用法示例。
在下文中一共展示了QBoxLayout.addItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QBoxLayout import addItem [as 别名]
def __init__(self, algorithms):
super(Window, self).__init__()
self.stackedWidget = QStackedWidget()
self.orientationCombo = QComboBox()
for category in categories:
pass
for algorithm in algorithms:
self.orientationCombo.addItem(algorithm.get_name())
self.stackedWidget.addWidget(GroupOfSliders(algorithm))
layout = QBoxLayout(QBoxLayout.TopToBottom)
settings_layout = QBoxLayout(QBoxLayout.TopToBottom)
settings_layout.addWidget(self.stackedWidget)
select_layout = QBoxLayout(QBoxLayout.TopToBottom)
select_layout.addWidget(self.orientationCombo)
layout.addItem(settings_layout)
layout.addItem(select_layout)
self.setLayout(layout)
self.setWindowTitle(algorithm.get_name() + " Settings")
示例2: IconEditorPalette
# 需要导入模块: from PyQt5.QtWidgets import QBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QBoxLayout import addItem [as 别名]
class IconEditorPalette(QWidget):
"""
Class implementing a palette widget for the icon editor.
@signal colorSelected(QColor) emitted after a new color has been selected
@signal compositingChanged(QPainter.CompositionMode) emitted to signal a
change of the compositing mode
"""
colorSelected = pyqtSignal(QColor)
compositingChanged = pyqtSignal(QPainter.CompositionMode)
def __init__(self, parent=None):
"""
Constructor
@param parent reference to the parent widget (QWidget)
"""
super(IconEditorPalette, self).__init__(parent)
if self.layoutDirection == Qt.Horizontal:
direction = QBoxLayout.LeftToRight
else:
direction = QBoxLayout.TopToBottom
self.__layout = QBoxLayout(direction, self)
self.setLayout(self.__layout)
self.__preview = QLabel(self)
self.__preview.setFrameStyle(QFrame.Panel | QFrame.Sunken)
self.__preview.setFixedHeight(64)
self.__preview.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self.__preview.setWhatsThis(self.tr(
"""<b>Preview</b>"""
"""<p>This is a 1:1 preview of the current icon.</p>"""
))
self.__layout.addWidget(self.__preview)
self.__color = QLabel(self)
self.__color.setFrameStyle(QFrame.Panel | QFrame.Sunken)
self.__color.setFixedHeight(24)
self.__color.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self.__color.setWhatsThis(self.tr(
"""<b>Current Color</b>"""
"""<p>This is the currently selected color used for drawing.</p>"""
))
self.__layout.addWidget(self.__color)
self.__colorTxt = QLabel(self)
self.__colorTxt.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self.__colorTxt.setWhatsThis(self.tr(
"""<b>Current Color Value</b>"""
"""<p>This is the currently selected color value used for"""
""" drawing.</p>"""
))
self.__layout.addWidget(self.__colorTxt)
self.__colorButton = QPushButton(self.tr("Select Color"), self)
self.__colorButton.setWhatsThis(self.tr(
"""<b>Select Color</b>"""
"""<p>Select the current drawing color via a color selection"""
""" dialog.</p>"""
))
self.__colorButton.clicked.connect(self.__selectColor)
self.__layout.addWidget(self.__colorButton)
self.__colorAlpha = QSpinBox(self)
self.__colorAlpha.setRange(0, 255)
self.__colorAlpha.setWhatsThis(self.tr(
"""<b>Select alpha channel value</b>"""
"""<p>Select the value for the alpha channel of the current"""
""" color.</p>"""
))
self.__layout.addWidget(self.__colorAlpha)
self.__colorAlpha.valueChanged[int].connect(self.__alphaChanged)
self.__compositingGroup = QGroupBox(self.tr("Compositing"), self)
self.__compositingGroupLayout = QVBoxLayout(self.__compositingGroup)
self.__compositingGroup.setLayout(self.__compositingGroupLayout)
self.__sourceButton = QRadioButton(self.tr("Replace"),
self.__compositingGroup)
self.__sourceButton.setWhatsThis(self.tr(
"""<b>Replace</b>"""
"""<p>Replace the existing pixel with a new color.</p>"""
))
self.__sourceButton.clicked[bool].connect(self.__compositingChanged)
self.__compositingGroupLayout.addWidget(self.__sourceButton)
self.__sourceOverButton = QRadioButton(self.tr("Blend"),
self.__compositingGroup)
self.__sourceOverButton.setWhatsThis(self.tr(
"""<b>Blend</b>"""
"""<p>Blend the new color over the existing pixel.</p>"""
))
self.__sourceOverButton.setChecked(True)
self.__sourceOverButton.clicked[bool].connect(
self.__compositingChanged)
self.__compositingGroupLayout.addWidget(self.__sourceOverButton)
self.__layout.addWidget(self.__compositingGroup)
spacer = QSpacerItem(
10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.__layout.addItem(spacer)
#.........这里部分代码省略.........