本文整理汇总了Python中PyQt5.QtWidgets.QBoxLayout.setAlignment方法的典型用法代码示例。如果您正苦于以下问题:Python QBoxLayout.setAlignment方法的具体用法?Python QBoxLayout.setAlignment怎么用?Python QBoxLayout.setAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QBoxLayout
的用法示例。
在下文中一共展示了QBoxLayout.setAlignment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_settings_widgets_from_pipeline_groupbox
# 需要导入模块: from PyQt5.QtWidgets import QBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QBoxLayout import setAlignment [as 别名]
def load_settings_widgets_from_pipeline_groupbox(self, position):
"""
Extracts all widgets from a single algorithm and returns a QBoxLayout
Args:
alg: the alg instance we extract from
Returns: a QBoxLayout containing all widgets for this particular alg.
"""
alg = self.pipeline.executed_cats[position].active_algorithm
print("alg " + str(alg))
print("cat " + str(self.pipeline.executed_cats[position]))
empty_flag = True
groupOfSliders = QGroupBox()
sp = QSizePolicy()
sp.setVerticalPolicy(QSizePolicy.Preferred)
# groupOfSliders.setSizePolicy(sp)
groupOfSliderssLayout = QBoxLayout(QBoxLayout.TopToBottom)
groupOfSliderssLayout.setContentsMargins(0, -0, -0, 0)
groupOfSliderssLayout.setAlignment(Qt.AlignTop)
groupOfSliderssLayout.setSpacing(0)
print("Build Slider @ "+ str(position))
# create integer sliders
for slider in alg.integer_sliders:
empty_flag = False
print("slider.value " + str(slider.value))
print("slider " + str(slider))
#print(alg.get_name() + ": add slider (int).")
groupOfSliderssLayout.addWidget(
SliderWidget(slider.name, slider.lower, slider.upper, slider.step_size, slider.value,
slider.set_value, False))
# create float sliders
for slider in alg.float_sliders:
empty_flag = False
#print(alg.get_name() + ": add slider (float).")
groupOfSliderssLayout.addWidget(
SliderWidget(slider.name, slider.lower, slider.upper, slider.step_size, slider.value,
slider.set_value, True), 0, Qt.AlignTop)
# create checkboxes
for checkbox in alg.checkboxes:
empty_flag = False
#print(alg.get_name() + ": add checkbox.")
groupOfSliderssLayout.addWidget(CheckBoxWidget(checkbox.name, checkbox.value, checkbox.set_value), 0,
Qt.AlignTop)
# create dropdowns
for combobox in alg.drop_downs:
empty_flag = False
#print(alg.get_name() + ": add combobox.")
groupOfSliderssLayout.addWidget(
ComboBoxWidget(combobox.name, combobox.options, combobox.set_value, combobox.value), 0, Qt.AlignTop)
if empty_flag:
label = QLabel()
label.setText("This algorithm has no Settings.")
groupOfSliderssLayout.addWidget(label, 0, Qt.AlignHCenter)
groupOfSliders.setLayout(groupOfSliderssLayout)
return groupOfSliders
示例2: E5SideBar
# 需要导入模块: from PyQt5.QtWidgets import QBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QBoxLayout import setAlignment [as 别名]
#.........这里部分代码省略.........
@return flag indicating the enabled state (boolean)
"""
return self.__tabBar.isTabEnabled(index)
def setTabEnabled(self, index, enabled):
"""
Public method to set the enabled state of a tab.
@param index index of the tab to set (integer)
@param enabled enabled state to set (boolean)
"""
self.__tabBar.setTabEnabled(index, enabled)
def orientation(self):
"""
Public method to get the orientation of the sidebar.
@return orientation of the sidebar (North, East, South, West)
"""
return self.__orientation
def setOrientation(self, orient):
"""
Public method to set the orientation of the sidebar.
@param orient orientation of the sidebar (North, East, South, West)
"""
if orient == E5SideBar.North:
self.__tabBar.setShape(QTabBar.RoundedNorth)
self.__tabBar.setSizePolicy(
QSizePolicy.Expanding, QSizePolicy.Preferred)
self.barLayout.setDirection(QBoxLayout.LeftToRight)
self.layout.setDirection(QBoxLayout.TopToBottom)
self.layout.setAlignment(self.barLayout, Qt.AlignLeft)
elif orient == E5SideBar.East:
self.__tabBar.setShape(QTabBar.RoundedEast)
self.__tabBar.setSizePolicy(
QSizePolicy.Preferred, QSizePolicy.Expanding)
self.barLayout.setDirection(QBoxLayout.TopToBottom)
self.layout.setDirection(QBoxLayout.RightToLeft)
self.layout.setAlignment(self.barLayout, Qt.AlignTop)
elif orient == E5SideBar.South:
self.__tabBar.setShape(QTabBar.RoundedSouth)
self.__tabBar.setSizePolicy(
QSizePolicy.Expanding, QSizePolicy.Preferred)
self.barLayout.setDirection(QBoxLayout.LeftToRight)
self.layout.setDirection(QBoxLayout.BottomToTop)
self.layout.setAlignment(self.barLayout, Qt.AlignLeft)
elif orient == E5SideBar.West:
self.__tabBar.setShape(QTabBar.RoundedWest)
self.__tabBar.setSizePolicy(
QSizePolicy.Preferred, QSizePolicy.Expanding)
self.barLayout.setDirection(QBoxLayout.TopToBottom)
self.layout.setDirection(QBoxLayout.LeftToRight)
self.layout.setAlignment(self.barLayout, Qt.AlignTop)
self.__orientation = orient
def tabIcon(self, index):
"""
Public method to get the icon of a tab.
@param index index of the tab (integer)
@return icon of the tab (QIcon)
"""
return self.__tabBar.tabIcon(index)