本文整理匯總了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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")
示例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)
示例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)
示例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)
示例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
示例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)
示例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)