当前位置: 首页>>代码示例>>Python>>正文


Python QtWidgets.QHBoxLayout方法代码示例

本文整理汇总了Python中qtpy.QtWidgets.QHBoxLayout方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QHBoxLayout方法的具体用法?Python QtWidgets.QHBoxLayout怎么用?Python QtWidgets.QHBoxLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qtpy.QtWidgets的用法示例。


在下文中一共展示了QtWidgets.QHBoxLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def __init__(self, layout: QtWidgets.QLayout, text: str, min: float = None, use_float: bool = True):
        """ A spin box with a label next to it.

        Args:
            layout: the layout to which to add the widget
            text: the label text
            min: the minimum value of the spin box
            use_float: whether to use a float spin box or an int spin box.
        """
        QtWidgets.QWidget.__init__(self)
        layout.addWidget(self)
        self.layout = QtWidgets.QHBoxLayout(self)
        self.label = QtWidgets.QLabel(text)
        self.layout.addWidget(self.label)
        self.layout.setContentsMargins(0, 0, 0, 0)

        self.type = float if use_float else int
        if use_float is False:
            self.input1 = QtWidgets.QSpinBox()
        else:
            self.input1 = QtWidgets.QDoubleSpinBox()
        if min is not None:
            self.input1.setMinimum(min)
        self.input1.valueChanged.connect(self.valueChangeEvent)
        self.layout.addWidget(self.input1) 
开发者ID:rgerum,项目名称:pylustrator,代码行数:27,代码来源:QLinkableWidgets.py

示例2: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def __init__(self, layer):
        super().__init__(layer)

        colormap_layout = QHBoxLayout()
        colormap_layout.addWidget(self.colorbarLabel)
        colormap_layout.addWidget(self.colormapComboBox)
        colormap_layout.addStretch(1)

        # grid_layout created in QtLayerControls
        # addWidget(widget, row, column, [row_span, column_span])
        self.grid_layout.addWidget(QLabel('opacity:'), 0, 0)
        self.grid_layout.addWidget(self.opacitySlider, 0, 1)
        self.grid_layout.addWidget(QLabel('contrast limits:'), 1, 0)
        self.grid_layout.addWidget(self.contrastLimitsSlider, 1, 1)
        self.grid_layout.addWidget(QLabel('gamma:'), 2, 0)
        self.grid_layout.addWidget(self.gammaSlider, 2, 1)
        self.grid_layout.addWidget(QLabel('colormap:'), 3, 0)
        self.grid_layout.addLayout(colormap_layout, 3, 1)
        self.grid_layout.addWidget(QLabel('blending:'), 4, 0)
        self.grid_layout.addWidget(self.blendComboBox, 4, 1)
        self.grid_layout.setRowStretch(5, 1)
        self.grid_layout.setColumnStretch(1, 1)
        self.grid_layout.setSpacing(4) 
开发者ID:napari,项目名称:napari,代码行数:25,代码来源:qt_surface_layer.py

示例3: test_add_dock_widget_from_list

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def test_add_dock_widget_from_list(make_test_viewer):
    """Test that we can add a list of widgets and they will be combined"""
    viewer = make_test_viewer()
    widg = QPushButton('button')
    widg2 = QPushButton('button')

    dwidg = viewer.window.add_dock_widget(
        [widg, widg2], name='test', area='right'
    )
    assert viewer.window._qt_window.findChild(QDockWidget, 'test')
    assert isinstance(dwidg.widget.layout, QVBoxLayout)

    dwidg = viewer.window.add_dock_widget(
        [widg, widg2], name='test2', area='bottom'
    )
    assert viewer.window._qt_window.findChild(QDockWidget, 'test2')
    assert isinstance(dwidg.widget.layout, QHBoxLayout) 
开发者ID:napari,项目名称:napari,代码行数:19,代码来源:test_qt_dock_widget.py

示例4: create_layout

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def create_layout(self):
        '''
        Create the layouts and add widgets
        '''
        check_box_layout = QtWidgets.QHBoxLayout()
        check_box_layout.setContentsMargins(2, 2, 2, 2)

        main_layout = QtWidgets.QVBoxLayout()
        main_layout.setContentsMargins(6, 6, 6, 6)

        main_layout.addWidget(self.descriptionLabel)
        main_layout.addWidget(self.descriptionWidget)
        main_layout.addWidget(self.tableWidget)

        main_layout.addWidget(self.chkboxLockedWidget)
        main_layout.addWidget(self.submitBtn)

        # main_layout.addStretch()

        self.setLayout(main_layout) 
开发者ID:TomMinor,项目名称:P4VFX,代码行数:22,代码来源:SubmitChangeWindow.py

示例5: create_layout

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def create_layout(self):
        '''
        Create the layouts and add widgets
        '''
        check_box_layout = QtWidgets.QHBoxLayout()
        check_box_layout.setContentsMargins(2, 2, 2, 2)

        main_layout = QtWidgets.QVBoxLayout()
        main_layout.setContentsMargins(6, 6, 6, 6)

        main_layout.addWidget(self.fileTree)
        main_layout.addWidget(self.tableWidget)

        bottomLayout = QtWidgets.QHBoxLayout()
        bottomLayout.addWidget(self.getRevisionBtn)
        bottomLayout.addSpacerItem(QtWidgets.QSpacerItem(20, 16))
        bottomLayout.addWidget(self.getPreviewBtn)
        bottomLayout.addSpacerItem(QtWidgets.QSpacerItem(20, 16))
        bottomLayout.addWidget(self.getLatestBtn)

        main_layout.addLayout(bottomLayout)
        main_layout.addWidget(self.horizontalLine)
        main_layout.addWidget(self.statusBar)

        self.setLayout(main_layout) 
开发者ID:TomMinor,项目名称:P4VFX,代码行数:27,代码来源:FileRevisionWindow.py

示例6: create_layout

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def create_layout(self):
        '''
        Create the layouts and add widgets
        '''
        check_box_layout = QtWidgets.QHBoxLayout()
        check_box_layout.setContentsMargins(2, 2, 2, 2)

        main_layout = QtWidgets.QVBoxLayout()
        main_layout.setContentsMargins(6, 6, 6, 6)

        main_layout.addWidget(self.tableWidget)

        bottomLayout = QtWidgets.QHBoxLayout()
        bottomLayout.addWidget(self.revertFileBtn)
        bottomLayout.addWidget(self.refreshBtn)
        bottomLayout.addSpacerItem(QtWidgets.QSpacerItem(400, 16))
        bottomLayout.addWidget(self.openSelectedBtn)

        main_layout.addLayout(bottomLayout)

        self.setLayout(main_layout) 
开发者ID:TomMinor,项目名称:P4VFX,代码行数:23,代码来源:OpenedFilesWindow.py

示例7: make_layout

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def make_layout(self):
        self.lay = QtWidgets.QHBoxLayout()
        self.lay.setContentsMargins(0, 0, 0, 0)
        self.real = FloatSpinBox(label=self.labeltext,
                                 min=self.minimum,
                                 max=self.maximum,
                                 increment=self.singleStep,
                                 log_increment=self.log_increment,
                                 halflife_seconds=self.halflife_seconds,
                                 decimals=self.decimals)
        self.imag = FloatSpinBox(label=self.labeltext,
                                 min=self.minimum,
                                 max=self.maximum,
                                 increment=self.singleStep,
                                 log_increment=self.log_increment,
                                 halflife_seconds=self.halflife_seconds,
                                 decimals=self.decimals)
        self.real.value_changed.connect(self.value_changed)
        self.lay.addWidget(self.real)
        self.label = QtWidgets.QLabel(" + j")
        self.lay.addWidget(self.label)
        self.imag.value_changed.connect(self.value_changed)
        self.lay.addWidget(self.imag)
        self.setLayout(self.lay)
        self.setFocusPolicy(QtCore.Qt.ClickFocus) 
开发者ID:lneuhaus,项目名称:pyrpl,代码行数:27,代码来源:spinbox.py

示例8: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def __init__(self, number, name, options, decimals=3):
        super(ListComboBox, self).__init__()
        self.setToolTip("First order filter frequencies \n"
                        "negative values are for high-pass \n"
                        "positive for low pass")
        self.lay = QtWidgets.QHBoxLayout()
        self.lay.setContentsMargins(0, 0, 0, 0)
        self.combos = []
        self.options = options
        self.decimals = decimals
        for i in range(number):
            combo = QtWidgets.QComboBox()
            self.combos.append(combo)
            combo.addItems(self.options)
            combo.currentIndexChanged.connect(self.value_changed)
            self.lay.addWidget(combo)
        self.setLayout(self.lay) 
开发者ID:lneuhaus,项目名称:pyrpl,代码行数:19,代码来源:attribute_widgets.py

示例9: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def __init__(self, parent):
        super(PostFiltering, self).__init__(parent)
        self.parent = parent
        aws = self.parent.attribute_widgets
        self.layout = QtWidgets.QVBoxLayout(self)

        aws = self.parent.attribute_widgets
        self.layout.addWidget(aws["additional_filter"])

        self.mod_layout = QtWidgets.QHBoxLayout()
        self.mod_layout.addWidget(aws["extra_module"])
        self.mod_layout.addWidget(aws["extra_module_state"])
        self.layout.addLayout(self.mod_layout)
        self.layout.setSpacing(12)

        self.setTitle("Pre-filtering before PID") 
开发者ID:lneuhaus,项目名称:pyrpl,代码行数:18,代码来源:lockbox_widget.py

示例10: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def __init__(self, *args, **kwargs):
        super(LineEditSearch, self).__init__(*args, **kwargs)
        self._empty = True
        self._show_icons = False
        self.button_icon = ButtonSearch()

        self.button_icon.setDefault(True)
        self.button_icon.setFocusPolicy(Qt.NoFocus)

#        layout = QHBoxLayout()
#        layout.addWidget(self.button_icon, 0, Qt.AlignRight)
#        layout.setSpacing(0)
#        layout.addSpacing(2)
#        layout.setContentsMargins(0, 0, 0, 0)
#        self.setLayout(layout)

        # Signals
        self.textEdited.connect(self.update_box)
        self.button_icon.clicked.connect(self.clear_text)
        self.button_icon.setVisible(False)

        self.update_box(None)
#        self.set_icon_size(16, 16)
        self.setTabOrder(self, self.button_icon) 
开发者ID:spyder-ide,项目名称:conda-manager,代码行数:26,代码来源:helperwidgets.py

示例11: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def __init__(self, axis: str, signal_target_changed: QtCore.Signal):
        """ A widget to change the tick properties

        Args:
            axis: whether to use the "x" or "y" axis
            signal_target_changed: a signal to emit when the target changed
        """
        QtWidgets.QWidget.__init__(self)
        self.setWindowTitle("Figure - " + axis + "-Axis - Ticks - Pylustrator")
        self.setWindowIcon(QtGui.QIcon(os.path.join(os.path.dirname(__file__), "icons", "ticks.ico")))
        self.layout = QtWidgets.QVBoxLayout(self)
        self.axis = axis

        self.label = QtWidgets.QLabel(
            "Ticks can be specified, one tick pre line.\nOptionally a label can be provided, e.g. 1 \"First\",")
        self.layout.addWidget(self.label)

        self.layout2 = QtWidgets.QHBoxLayout()
        self.layout.addLayout(self.layout2)

        self.input_ticks = TextWidget(self.layout2, axis + "-Ticks:", multiline=True, horizontal=False)
        self.input_ticks.editingFinished.connect(self.ticksChanged)

        self.input_ticks2 = TextWidget(self.layout2, axis + "-Ticks (minor):", multiline=True, horizontal=False)
        self.input_ticks2.editingFinished.connect(self.ticksChanged2)

        self.input_scale = ComboWidget(self.layout, axis + "-Scale", ["linear", "log", "symlog", "logit"])
        self.input_scale.link(axis + "scale", signal_target_changed)

        self.input_font = TextPropertiesWidget(self.layout)

        self.input_labelpad = NumberWidget(self.layout, axis + "-Labelpad", min=-999)
        self.input_labelpad.link(axis + "axis.labelpad", signal_target_changed, direct=True)

        self.button_ok = QtWidgets.QPushButton("Ok")
        self.layout.addWidget(self.button_ok)
        self.button_ok.clicked.connect(self.hide) 
开发者ID:rgerum,项目名称:pylustrator,代码行数:39,代码来源:QComplexWidgets.py

示例12: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def __init__(self, number, *args, **kwargs):
        """ An alternative to the pylustrator gui that only displays the color chooser. Mainly for testing purpose. """
        QtWidgets.QWidget.__init__(self)

        # widget layout and elements
        self.setWindowTitle("Figure %s" % number)
        self.setWindowIcon(qta.icon("fa.bar-chart"))
        self.layout_main = QtWidgets.QHBoxLayout(self)

        # add plot layout
        self.layout_plot = QtWidgets.QVBoxLayout(self)
        self.layout_main.addLayout(self.layout_plot)

        # add plot canvas
        self.canvas = MatplotlibWidget(self)
        self.canvas.window = self
        self.layout_plot.addWidget(self.canvas)
        _pylab_helpers.Gcf.set_active(self.canvas.manager)

        # add toolbar
        self.navi_toolbar = NavigationToolbar(self.canvas, self)
        self.layout_plot.addWidget(self.navi_toolbar)
        self.layout_plot.addStretch()

        self.colorWidget = ColorChooserWidget(self, self.canvas)
        self.layout_main.addWidget(self.colorWidget) 
开发者ID:rgerum,项目名称:pylustrator,代码行数:28,代码来源:QtGui.py

示例13: create_widget

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def create_widget():
    widget = QWidget()
    layout = QHBoxLayout()
    widget.setLayout(layout)
    widget.status = QLabel('ready...')
    layout.addWidget(widget.status)
    widget.show()
    return widget 
开发者ID:napari,项目名称:napari,代码行数:10,代码来源:multithreading_simple.py

示例14: __init__

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def __init__(self, viewer):
        super().__init__()

        self.viewer = viewer
        self.deleteButton = QtDeleteButton(self.viewer)
        self.newPointsButton = QtViewerPushButton(
            self.viewer,
            'new_points',
            'New points layer',
            lambda: self.viewer.add_points(data=None),
        )
        self.newShapesButton = QtViewerPushButton(
            self.viewer,
            'new_shapes',
            'New shapes layer',
            lambda: self.viewer.add_shapes(data=None),
        )
        self.newLabelsButton = QtViewerPushButton(
            self.viewer,
            'new_labels',
            'New labels layer',
            lambda: self.viewer._new_labels(),
        )

        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self.newPointsButton)
        layout.addWidget(self.newShapesButton)
        layout.addWidget(self.newLabelsButton)
        layout.addStretch(0)
        layout.addWidget(self.deleteButton)
        self.setLayout(layout) 
开发者ID:napari,项目名称:napari,代码行数:34,代码来源:qt_viewer_buttons.py

示例15: setRevisionTableColumn

# 需要导入模块: from qtpy import QtWidgets [as 别名]
# 或者: from qtpy.QtWidgets import QHBoxLayout [as 别名]
def setRevisionTableColumn(self, row, column, value, icon=None, isLongText=False):
        value = str(value)

        widget = QtWidgets.QWidget()
        layout = QtWidgets.QHBoxLayout()
        layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignHCenter)

        # Use a QLineEdit to allow the text to be copied if the data is large
        if isLongText:
            textLabel = QtWidgets.QLineEdit()
            textLabel.setText(value)
            textLabel.setCursorPosition(0)
            textLabel.setReadOnly(True)
            textLabel.setStyleSheet("QLineEdit { border: none }")
        else:
            textLabel = QtWidgets.QLabel(value)
            textLabel.setStyleSheet("QLabel { border: none } ")

        # layout.setContentsMargins(4, 0, 4, 0)
        
        if icon:
            iconPic = QtGui.QPixmap(icon)
            iconPic = iconPic.scaled(16, 16)
            iconLabel = QtWidgets.QLabel()
            iconLabel.setPixmap(iconPic)
            layout.addWidget(iconLabel)
        layout.addWidget(textLabel)

        widget.setLayout(layout)

        self.tableWidget.setCellWidget(row, column, widget) 
开发者ID:TomMinor,项目名称:P4VFX,代码行数:33,代码来源:FileRevisionWindow.py


注:本文中的qtpy.QtWidgets.QHBoxLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。