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


Python Qt.Horizontal方法代码示例

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


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

示例1: headerData

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import Horizontal [as 别名]
def headerData(self, section, orientation, role=Qt.DisplayRole):
        """Return data for specified header."""
        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
            return HEADERS[section]
        else:
            return None 
开发者ID:spyder-ide,项目名称:spyder-unittest,代码行数:8,代码来源:datatree.py

示例2: _create_range_slider_widget

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import Horizontal [as 别名]
def _create_range_slider_widget(self):
        """Creates a range slider widget for a given axis."""
        _range = self.dims.range[self.axis]
        # Set the maximum values of the range slider to be one step less than
        # the range of the layer as otherwise the slider can move beyond the
        # shape of the layer as the endpoint is included
        _range = (_range[0], _range[1] - _range[2], _range[2])
        point = self.dims.point[self.axis]

        slider = ModifiedScrollBar(Qt.Horizontal)
        slider.setFocusPolicy(Qt.NoFocus)
        slider.setMinimum(int(_range[0]))
        slider.setMaximum(int(_range[1]))
        slider.setSingleStep(int(_range[2]))
        slider.setPageStep(int(_range[2]))
        slider.setValue(point)

        # Listener to be used for sending events back to model:
        slider.valueChanged.connect(
            lambda value: self.dims.set_point(self.axis, value)
        )

        def slider_focused_listener():
            self.qt_dims.last_used = self.axis

        # linking focus listener to the last used:
        slider.sliderPressed.connect(slider_focused_listener)
        self.slider = slider 
开发者ID:napari,项目名称:napari,代码行数:30,代码来源:qt_dims_slider.py

示例3: _move_to_mouse_position

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import Horizontal [as 别名]
def _move_to_mouse_position(self, event):
        opt = QStyleOptionSlider()
        self.initStyleOption(opt)
        control = self.style().hitTestComplexControl(
            QStyle.CC_ScrollBar, opt, event.pos(), self
        )
        if (
            control == QStyle.SC_ScrollBarAddPage
            or control == QStyle.SC_ScrollBarSubPage
        ):
            # scroll here
            gr = self.style().subControlRect(
                QStyle.CC_ScrollBar, opt, QStyle.SC_ScrollBarGroove, self
            )
            sr = self.style().subControlRect(
                QStyle.CC_ScrollBar, opt, QStyle.SC_ScrollBarSlider, self
            )
            if self.orientation() == Qt.Horizontal:
                pos = event.pos().x()
                sliderLength = sr.width()
                sliderMin = gr.x()
                sliderMax = gr.right() - sliderLength + 1
                if self.layoutDirection() == Qt.RightToLeft:
                    opt.upsideDown = not opt.upsideDown
            else:
                pos = event.pos().y()
                sliderLength = sr.height()
                sliderMin = gr.y()
                sliderMax = gr.bottom() - sliderLength + 1
            self.setValue(
                QStyle.sliderValueFromPosition(
                    self.minimum(),
                    self.maximum(),
                    pos - sliderMin - sliderLength // 2,
                    sliderMax - sliderMin,
                    opt.upsideDown,
                )
            ) 
开发者ID:napari,项目名称:napari,代码行数:40,代码来源:qt_scrollbar.py

示例4: resetIndex

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import Horizontal [as 别名]
def resetIndex(self):
        hm = self.sMinH.value()
        vm = self.sMinV.value()
        self.model.setRange(hm, vm)
        self.model.headerDataChanged.emit(Qt.Vertical, 1, 1)
        self.model.headerDataChanged.emit(Qt.Horizontal, 1, 1) 
开发者ID:pyCGNS,项目名称:pyCGNS,代码行数:8,代码来源:wform.py

示例5: __init__

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import Horizontal [as 别名]
def __init__(self, *args, **kwargs):
        super(ClosePackageManagerDialog, self).__init__(*args, **kwargs)
        self.label_icon = QLabel()
        self.label_about = QLabel('Conda is still busy.\n\n'
                                  'Do you want to cancel the process?')
        self.button_ok = QPushButton('Yes')
        self.button_cancel = QPushButton('No')
        self.buttonbox = QDialogButtonBox(Qt.Horizontal)

        # Widget setup
        self.buttonbox.addButton(self.button_ok, QDialogButtonBox.ActionRole)
        self.buttonbox.addButton(self.button_cancel,
                                 QDialogButtonBox.ActionRole)
#        self.label_icon.setPixmap(QPixmap(images.ANACONDA_ICON_64_PATH))
        self.setWindowTitle("Cancel Process")

        # Layouts
        h_layout = QHBoxLayout()
        h_layout.addWidget(self.label_icon, 0, Qt.AlignTop)
        h_layout.addSpacing(10)
        h_layout.addWidget(self.label_about)

        main_layout = QVBoxLayout()
        main_layout.addLayout(h_layout)
        main_layout.addSpacing(20)
        main_layout.addWidget(self.buttonbox)
        self.setLayout(main_layout)

        # Signals
        self.button_ok.clicked.connect(self.accept)
        self.button_cancel.clicked.connect(self.reject) 
开发者ID:spyder-ide,项目名称:conda-manager,代码行数:33,代码来源:close.py

示例6: __init__

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import Horizontal [as 别名]
def __init__(self, theme='dark', emphasized=False):
        super().__init__(None)
        self.setProperty('emphasized', emphasized)
        self.setStyleSheet(template(raw_stylesheet, **palettes[theme]))
        lay = QVBoxLayout()
        self.setLayout(lay)
        lay.addWidget(QPushButton('push button'))
        box = QComboBox()
        box.addItems(['a', 'b', 'c', 'cd'])
        lay.addWidget(box)
        lay.addWidget(QFontComboBox())

        hbox = QHBoxLayout()
        chk = QCheckBox('tristate')
        chk.setToolTip('I am a tooltip')
        chk.setTristate(True)
        chk.setCheckState(Qt.PartiallyChecked)
        chk3 = QCheckBox('checked')
        chk3.setChecked(True)
        hbox.addWidget(QCheckBox('unchecked'))
        hbox.addWidget(chk)
        hbox.addWidget(chk3)
        lay.addLayout(hbox)

        lay.addWidget(TabDemo(emphasized=emphasized))

        sld = QSlider(Qt.Horizontal)
        sld.setValue(50)
        lay.addWidget(sld)
        scroll = QScrollBar(Qt.Horizontal)
        scroll.setValue(50)
        lay.addWidget(scroll)
        lay.addWidget(QHRangeSlider(parent=self))
        text = QTextEdit()
        text.setMaximumHeight(100)
        text.setHtml(blurb)
        lay.addWidget(text)
        lay.addWidget(QTimeEdit())
        edit = QLineEdit()
        edit.setPlaceholderText('LineEdit placeholder...')
        lay.addWidget(edit)
        lay.addWidget(QLabel('label'))
        prog = QProgressBar()
        prog.setValue(50)
        lay.addWidget(prog)
        groupBox = QGroupBox("Exclusive Radio Buttons")
        radio1 = QRadioButton("&Radio button 1")
        radio2 = QRadioButton("R&adio button 2")
        radio3 = QRadioButton("Ra&dio button 3")
        radio1.setChecked(True)
        hbox = QHBoxLayout()
        hbox.addWidget(radio1)
        hbox.addWidget(radio2)
        hbox.addWidget(radio3)
        hbox.addStretch(1)
        groupBox.setLayout(hbox)
        lay.addWidget(groupBox) 
开发者ID:napari,项目名称:napari,代码行数:59,代码来源:theme_sample.py

示例7: __init__

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

        self.events.add(
            colormap=Event,
            contrast_limits=Event,
            contrast_limits_range=Event,
            gamma=Event,
        )

        comboBox = QComboBox(self)
        comboBox.setObjectName("colormapComboBox")
        comboBox.activated[str].connect(self.events.colormap)
        self.colormapComboBox = comboBox

        # Create contrast_limits slider
        self.contrastLimitsSlider = QHRangeSlider(parent=self)
        self.contrastLimitsSlider.mousePressEvent = self._clim_mousepress
        self.contrastLimitsSlider.valuesChanged.connect(
            self.events.contrast_limits
        )
        self.contrastLimitsSlider.rangeChanged.connect(
            self.events.contrast_limits_range
        )

        # gamma slider
        sld = QSlider(Qt.Horizontal, parent=self)
        sld.setFocusPolicy(Qt.NoFocus)
        sld.setMinimum(2)
        sld.setMaximum(200)
        sld.setSingleStep(2)
        sld.setValue(100)
        sld.valueChanged.connect(lambda value: self.events.gamma(value / 100))
        self.gammaSlider = sld

        self.colorbarLabel = QLabel(parent=self)
        self.colorbarLabel.setObjectName('colorbar')
        self.colorbarLabel.setToolTip('Colorbar')

        # Once EVH refactor is done, these can be moved to an initialization
        # outside of this object
        self._on_gamma_change(self.layer.gamma)
        self._set_colormaps(self.layer.colormaps)
        self._on_colormap_change(self.layer.colormap[0])
        self._on_contrast_limits_range_change(self.layer.contrast_limits_range)
        self._on_contrast_limits_change(self.layer.contrast_limits) 
开发者ID:napari,项目名称:napari,代码行数:48,代码来源:qt_image_base_layer.py

示例8: __init__

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

        self.events = EmitterGroup(
            source=self,
            auto_connect=False,
            blending=Event,
            opacity=Event,
            status=Event,
        )

        # When the EVH refactor #1376 is done we might not even need the layer
        # attribute anymore as all data updates will be through the handler.
        # At that point we could remove the attribute and do the registering
        # and connecting outside this class and never even need to pass the
        # layer to this class.
        self.layer = layer
        self.layer.event_handler.register_listener(self)
        self.events.connect(self.layer.event_handler.on_change)

        self.setObjectName('layer')
        self.setMouseTracking(True)

        self.grid_layout = QGridLayout(self)
        self.grid_layout.setContentsMargins(0, 0, 0, 0)
        self.grid_layout.setSpacing(2)
        self.grid_layout.setColumnMinimumWidth(0, 86)
        self.grid_layout.setColumnStretch(1, 1)
        self.setLayout(self.grid_layout)

        sld = QSlider(Qt.Horizontal, parent=self)
        sld.setFocusPolicy(Qt.NoFocus)
        sld.setMinimum(0)
        sld.setMaximum(100)
        sld.setSingleStep(1)
        sld.valueChanged.connect(lambda v: self.events.opacity(v / 100))
        self.opacitySlider = sld

        blend_comboBox = QComboBox(self)
        blend_comboBox.addItems(Blending.keys())
        blend_comboBox.activated[str].connect(self.events.blending)
        self.blendComboBox = blend_comboBox

        # Once EVH refactor is done, these can be moved to an initialization
        # outside of this object
        self._on_opacity_change(self.layer.opacity)
        self._on_blending_change(self.layer.blending) 
开发者ID:napari,项目名称:napari,代码行数:49,代码来源:qt_base_layer.py

示例9: __init__

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import Horizontal [as 别名]
def __init__(
        self,
        vpoints: Sequence[VPoint],
        vlinks: Sequence[VLink],
        path: _Paths,
        slider_path: _SliderPaths,
        monochrome: bool,
        parent: QWidget
    ):
        super(AnimateDialog, self).__init__(parent)
        self.setWindowTitle("Vector Animation")
        self.setWindowFlags(self.windowFlags() | Qt.WindowMaximizeButtonHint
                            & ~Qt.WindowContextHelpButtonHint)
        self.setMinimumSize(800, 600)
        self.setModal(True)
        main_layout = QVBoxLayout(self)
        layout = QHBoxLayout(self)
        self.label = QLabel(self)
        layout.addItem(QSpacerItem(40, 20, QSizePolicy.Expanding,
                                   QSizePolicy.Minimum))
        layout.addWidget(self.label)
        main_layout.addLayout(layout)
        self.canvas = _DynamicCanvas(vpoints, vlinks, path, slider_path, self)
        self.canvas.set_monochrome_mode(monochrome)
        self.canvas.update_pos.connect(self.__set_pos)
        main_layout.addWidget(self.canvas)
        layout = QHBoxLayout(self)
        self.play = QPushButton(QIcon(QPixmap(":/icons/play.png")), "", self)
        self.play.setCheckable(True)
        self.play.clicked.connect(self.__play)
        layout.addWidget(self.play)
        self.slider = QSlider(Qt.Horizontal, self)
        self.slider.setMaximum(max(len(p) for p in path) - 1)
        self.slider.valueChanged.connect(self.canvas.set_index)
        layout.addWidget(self.slider)
        factor = QDoubleSpinBox(self)
        factor.valueChanged.connect(self.canvas.set_factor)
        factor.setRange(0.01, 9999)
        factor.setValue(50)
        layout.addWidget(factor)
        main_layout.addLayout(layout)
        self.timer = QTimer()
        self.timer.setInterval(10)
        self.timer.timeout.connect(self.__move_ind) 
开发者ID:KmolYuan,项目名称:Pyslvs-UI,代码行数:46,代码来源:preview.py

示例10: setup_page

# 需要导入模块: from qtpy.QtCore import Qt [as 别名]
# 或者: from qtpy.QtCore.Qt import Horizontal [as 别名]
def setup_page(self):
        self.api = ManagerAPI()
        self.set_option('api', self.api.client_get_api_url())
        self.apply_callback = self.apply_setting_options

        group_api = QGroupBox(_("Anaconda client"))
        self.lineedit_api = self.create_lineedit(_('API url'), 'api',
                                                 alignment=Qt.Horizontal)

#        group_network = QGroupBox(_("Network proxy"))
#        checkbox_proxy = self.create_checkbox(_("Use custom proxy"),
#                                              'use_network_proxy',
#                                              default=False)
#        server = self.create_lineedit(_('Server'), 'server', default='',
#                                      alignment=Qt.Horizontal)
#        port = self.create_lineedit(_('Port'), 'port', default='',
#                                    alignment=Qt.Horizontal)
#        user = self.create_lineedit(_('User'), 'user', default='',
#                                    alignment=Qt.Horizontal)
#        password = self.create_lineedit(_('Password'), 'password', default='',
#                                        alignment=Qt.Horizontal)
        
        # Layouts
        layout_api = QVBoxLayout()
        layout_api.addWidget(self.lineedit_api )
        group_api.setLayout(layout_api)

#        layout_proxy = QGridLayout()
#        layout_proxy.addWidget(checkbox_proxy, 0, 0, 1, 2)
#        layout_proxy.addWidget(server.label, 1, 0)
#        layout_proxy.addWidget(server.textbox, 1, 1)
#        layout_proxy.addWidget(port.label, 1, 2)
#        layout_proxy.addWidget(port.textbox, 1, 3)
#        layout_proxy.addWidget(user.label, 2, 0)
#        layout_proxy.addWidget(user.textbox, 2, 1)
#        layout_proxy.addWidget(password.label, 2, 2)
#        layout_proxy.addWidget(password.textbox, 2, 3)
#        group_network.setLayout(layout_proxy)

        vlayout = QVBoxLayout()
        vlayout.addWidget(group_api)
#        vlayout.addWidget(group_network)
        vlayout.addStretch(1)
        self.setLayout(vlayout)
#
#        # Setup
#        checked = self.get_option('use_network_proxy', default=False)
#        checkbox_proxy.toggled.connect(server.textbox.setEnabled)
#        checkbox_proxy.toggled.connect(port.textbox.setEnabled)
#        checkbox_proxy.toggled.connect(user.textbox.setEnabled)
#        checkbox_proxy.toggled.connect(password.textbox.setEnabled)
#        server.textbox.setEnabled(checked)
#        port.textbox.setEnabled(checked)
#        user.textbox.setEnabled(checked)
#        password.textbox.setEnabled(checked) 
开发者ID:spyder-ide,项目名称:conda-manager,代码行数:57,代码来源:condapackages.py


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