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


Python Qt.Horizontal方法代码示例

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


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

示例1: _load_preferred_size

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def _load_preferred_size(self) -> None:
        """Load the preferred size of the inspector widget."""
        assert self._position is not None
        full = (self.width() if self.orientation() == Qt.Horizontal
                else self.height())

        # If we first open the inspector with a window size of < 300px
        # (self._SMALL_SIZE_THRESHOLD), we don't want to default to half of the
        # window size as the small window is likely a temporary situation and
        # the inspector isn't very usable in that state.
        self._preferred_size = max(self._SMALL_SIZE_THRESHOLD, full // 2)

        try:
            size = int(configfiles.state['inspector'][self._position.name])
        except KeyError:
            # First start
            pass
        except ValueError as e:
            log.misc.error("Could not read inspector size: {}".format(e))
        else:
            self._preferred_size = int(size) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:23,代码来源:miscwidgets.py

示例2: buttonsLayout

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def buttonsLayout(self):
        self.matrix = False
        vbox = QVBoxLayout()
        interactionModeLayout = QVBoxLayout()
        self.interactionModeButton = QtWidgets.QPushButton('visma')
        self.interactionModeButton.clicked.connect(self.interactionMode)
        interactionModeLayout.addWidget(self.interactionModeButton)
        interactionModeWidget = QWidget(self)
        interactionModeWidget.setLayout(interactionModeLayout)
        interactionModeWidget.setFixedSize(275, 50)
        topButtonSplitter = QSplitter(Qt.Horizontal)
        topButtonSplitter.addWidget(interactionModeWidget)
        permanentButtons = QWidget(self)
        topButtonSplitter.addWidget(permanentButtons)
        self.bottomButton = QFrame()
        self.buttonSplitter = QSplitter(Qt.Vertical)
        self.buttonSplitter.addWidget(topButtonSplitter)
        self.buttonSplitter.addWidget(self.bottomButton)
        vbox.addWidget(self.buttonSplitter)
        return vbox 
开发者ID:aerospaceresearch,项目名称:visma,代码行数:22,代码来源:window.py

示例3: headerData

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def headerData(self, section, orientation, role=Qt.DisplayRole):
                '''The data for the given role and section in the header with
                the specified orientation.

                Args:
                    section (:obj:`int`):
                    orientation (:obj:`Qt.Orientation`):
                    role (:obj:`Qt.DisplayRole`):

                Returns:
                    data
                '''
                if role != Qt.DisplayRole:
                    return None

                if (orientation == Qt.Horizontal) and (section < len(self.header)):
                    return self.header[section]

                return None 
开发者ID:vrtadmin,项目名称:FIRST-plugin-ida,代码行数:21,代码来源:first.py

示例4: setSliders

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def setSliders(self):
        """设置进度条君。"""
        self.slider = QSlider(self)
        self.slider.setMinimumHeight(5)
        self.slider.setMinimumWidth(440)
        # 将范围设置成1000滚动时更舒服。
        self.slider.setRange(0, 1000)
        self.slider.setObjectName("slider")
        self.slider.setOrientation(Qt.Horizontal)
        self.slider.sliderReleased.connect(self.sliderEvent)
        self.slider.sliderPressed.connect(self.sliderPressEvent)

        self.volumeSlider = QSlider(self)
        self.volumeSlider.setValue(100)
        self.volumeSlider.setMinimumHeight(5)
        self.volumeSlider.setObjectName("volumeSlider")
        self.volumeSlider.setOrientation(Qt.Horizontal)
        self.volumeSlider.valueChanged.connect(self.volumeChangedEvent) 
开发者ID:HuberTRoy,项目名称:MusicBox,代码行数:20,代码来源:player.py

示例5: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.panBox = QGroupBox(self)
        self.panBox.setGeometry(0, 0, self.width(), 80)
        self.panBox.setLayout(QHBoxLayout(self.panBox))
        self.layout().addWidget(self.panBox)

        self.panSlider = QSlider(self.panBox)
        self.panSlider.setRange(-10, 10)
        self.panSlider.setPageStep(1)
        self.panSlider.setOrientation(Qt.Horizontal)
        self.panSlider.valueChanged.connect(self.pan_changed)
        self.panBox.layout().addWidget(self.panSlider)

        self.panLabel = QLabel(self.panBox)
        self.panLabel.setAlignment(Qt.AlignCenter)
        self.panBox.layout().addWidget(self.panLabel)

        self.panBox.layout().setStretch(0, 5)
        self.panBox.layout().setStretch(1, 1)

        self.retransaleUi() 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:27,代码来源:audio_pan.py

示例6: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def __init__(self, cue, **kwargs):
        super().__init__(cue, **kwargs)
        self.setGeometry(0, 0, self.width(), 110)

        self._dbmeter_element = None

        self.seekSlider = QClickSlider(self.gridLayoutWidget)
        self.seekSlider.setOrientation(Qt.Horizontal)
        self.seekSlider.setRange(0, cue.duration)
        self.seekSlider.setFocusPolicy(Qt.NoFocus)
        self.seekSlider.sliderMoved.connect(self._seek)
        self.seekSlider.sliderJumped.connect(self._seek)
        self.seekSlider.setVisible(False)

        self.dbmeter = QDbMeter(self.gridLayoutWidget)
        self.dbmeter.setVisible(False)

        cue.changed('duration').connect(self._update_duration,
                                        Connection.QtQueued) 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:21,代码来源:playing_mediawidget.py

示例7: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def __init__(self, types, parent=None, color=Qt.black):
        """
        :param types:                    渐变类型(0-透明,1-彩虹)
        :param parent:
        """
        super(CColorSlider, self).__init__(Qt.Horizontal, parent)
        self.setObjectName('Custom_Color_Slider')
        self.setCursor(Qt.PointingHandCursor)
        self.valueChanged.connect(self.onValueChanged)
        self._types = types
        self._color = color
        self._isFirstShow = True
        self._imageRainbow = None                       # 彩虹背景图
        self._imageAlphaColor = None                    # 带颜色透明图
        self._imageAlphaTmp = None                      # 透明方格
        self._imageAlpha = None                         # 带颜色透明背景和方格合成图
        self._imageCircle = None                        # 圆形滑块图
        self._imageCircleHover = None                   # 圆形滑块悬停图
        self.setToolTip('彩虹色' if self._types == self.TypeRainbow else '透明度') 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:21,代码来源:CColorSlider.py

示例8: pixelPosToRangeValue

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def pixelPosToRangeValue(self, pos):
        option = QStyleOptionSlider()
        self.initStyleOption(option)
        gr = self.style().subControlRect(QStyle.CC_Slider,
                                         option, QStyle.SC_SliderGroove, self)
        sr = self.style().subControlRect(QStyle.CC_Slider,
                                         option, QStyle.SC_SliderHandle, self)
        if self.orientation() == Qt.Horizontal:
            sliderLength = sr.width()
            sliderMin = gr.x()
            sliderMax = gr.right() - sliderLength + 1
        else:
            sliderLength = sr.height()
            sliderMin = gr.y()
            sliderMax = gr.bottom() - sliderLength + 1
        return QStyle.sliderValueFromPosition(
            self.minimum(), self.maximum(), pos - sliderMin,
            sliderMax - sliderMin, option.upsideDown) 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:20,代码来源:CColorSlider.py

示例9: mousePressEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def mousePressEvent(self, event):
        # 获取上面的拉动块位置
        option = QStyleOptionSlider()
        self.initStyleOption(option)
        rect = self.style().subControlRect(
            QStyle.CC_Slider, option, QStyle.SC_SliderHandle, self)
        if rect.contains(event.pos()):
            # 如果鼠标点击的位置在滑块上则交给Qt自行处理
            super(CSlider, self).mousePressEvent(event)
            return
        if self.orientation() == Qt.Horizontal:
            # 横向,要考虑invertedAppearance是否反向显示的问题
            self.setValue(self.style().sliderValueFromPosition(
                self.minimum(), self.maximum(),
                event.x() if not self.invertedAppearance() else (self.width(
                ) - event.x()), self.width()))
        else:
            # 纵向
            self.setValue(self.style().sliderValueFromPosition(
                self.minimum(), self.maximum(),
                (self.height() - event.y()) if not self.invertedAppearance(
                ) else event.y(), self.height())) 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:24,代码来源:CSlider.py

示例10: initUI

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def initUI(self):      

        OVER_CAPACITY = 750

        sld = QSlider(Qt.Horizontal, self)
        sld.setFocusPolicy(Qt.NoFocus)
        sld.setRange(1, OVER_CAPACITY)
        sld.setValue(75)
        sld.setGeometry(30, 40, 150, 30)

        self.c = Communicate()        
        self.wid = BurningWidget()
        self.c.updateBW[int].connect(self.wid.setValue)

        sld.valueChanged[int].connect(self.changeValue)
        hbox = QHBoxLayout()
        hbox.addWidget(self.wid)
        vbox = QVBoxLayout()
        vbox.addStretch(1)
        vbox.addLayout(hbox)
        self.setLayout(vbox)

        self.setGeometry(300, 300, 390, 210)
        self.setWindowTitle('Burning widget')
        self.show() 
开发者ID:Yeah-Kun,项目名称:python,代码行数:27,代码来源:customwidget.py

示例11: createButtonBox

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def createButtonBox(self, cmd_fct):
        def clicked(button):
            command = button.text()
            specsheet = self.specsheet_dict[self.conjugate_type]
            if cmd_fct:
                cmd_fct(self, command, specsheet)
            else:
                print(button.text(), 'button pressed')

        buttonbox = QDialogButtonBox(qt.Horizontal, self)
        buttonbox.addButton('New', QDialogButtonBox.ApplyRole)
        buttonbox.addButton(QDialogButtonBox.Apply)
        buttonbox.addButton('Update', QDialogButtonBox.ApplyRole)
        buttonbox.addButton(QDialogButtonBox.Close)
        for b in buttonbox.buttons():
            b.setAutoDefault(False)
#        buttonbox.setCenterButtons(True)
        buttonbox.clicked.connect(clicked)
        return buttonbox 
开发者ID:mjhoptics,项目名称:ray-optics,代码行数:21,代码来源:idealimagerdialog.py

示例12: export_all

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def export_all(self):
        filename = QtWidgets.QFileDialog.getSaveFileName(self.parent, 'Save CSV export to...')
        if filename == None:
            return

        num_rows = self.sub_signature_model.rowCount()
        num_columns = self.sub_signature_model.columnCount()
        f = open(filename[0], 'wb')

        csvout = csv.writer(f)
        #   Write header to CSV and then each row
        csvout.writerow([self.sub_signature_model.headerData(x, Qt.Horizontal) for x in xrange(0, num_columns)])
        for row in xrange(0, num_rows):
            column_data = [self.sub_signature_model.index(row, column) for column in xrange(0, num_columns)]
            csvout.writerow([self.sub_signature_model.data(index) for index in column_data])
        print '[CASCPlugin] Exported %d sub signatures to %s' % (num_rows, str(filename[0]))
        f.close() 
开发者ID:Cisco-Talos,项目名称:CASC,代码行数:19,代码来源:casc_plugin.py

示例13: doLayout

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def doLayout(self, rect, testOnly):
        x = rect.x()
        y = rect.y()
        lineHeight = 0
        for item in self.itemList:
            wid = item.widget()
            spaceX = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton, QSizePolicy.PushButton,
                                                                Qt.Horizontal)
            spaceY = self.spacing() + wid.style().layoutSpacing(QSizePolicy.PushButton, QSizePolicy.PushButton,
                                                                Qt.Vertical)
            nextX = x + item.sizeHint().width() + spaceX
            if nextX - spaceX > rect.right() and lineHeight > 0:
                x = rect.x()
                y = y + lineHeight + spaceY
                nextX = x + item.sizeHint().width() + spaceX
                lineHeight = 0
            if not testOnly:
                item.setGeometry(QRect(QPoint(x, y), item.sizeHint()))
            x = nextX
            lineHeight = max(lineHeight, item.sizeHint().height())
        return y + lineHeight - rect.y() 
开发者ID:hustlei,项目名称:QssStylesheetEditor,代码行数:23,代码来源:flow_layout.py

示例14: setParameters

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def setParameters(self, minValue, maxValue):
        # Creates the slider for the OpenCV filter, with min, max, default and
        # step values
        self.thresh_sld = QSlider(Qt.Horizontal, self)
        self.thresh_sld.setFocusPolicy(Qt.NoFocus)
        self.thresh_sld.setMinimum(minValue)
        self.thresh_sld.setMaximum(maxValue)
        self.thresh_sld.setValue(self.k[0])
        self.thresh_sld.setSingleStep(2) 
开发者ID:anonymouslycn,项目名称:bjtu_BinocularCameraRecord,代码行数:11,代码来源:FilterCvQtContainer.py

示例15: test_adjust_size

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Horizontal [as 别名]
def test_adjust_size(self, old_window_size, preferred_size,
                         new_window_size, exp_inspector_size,
                         position, splitter, fake_inspector, qtbot):
        def resize(dim):
            size = (QSize(dim, 666) if splitter.orientation() == Qt.Horizontal
                    else QSize(666, dim))
            splitter.resize(size)
            if splitter.size() != size:
                pytest.skip("Resizing window failed")

        splitter.set_inspector(fake_inspector, position)
        splitter.show()
        resize(old_window_size)

        handle_width = 4
        splitter.setHandleWidth(handle_width)

        splitter_idx = 1
        if position in [inspector.Position.left, inspector.Position.top]:
            splitter_pos = preferred_size - handle_width//2
        else:
            splitter_pos = old_window_size - preferred_size - handle_width//2
        splitter.moveSplitter(splitter_pos, splitter_idx)

        resize(new_window_size)

        sizes = splitter.sizes()
        inspector_size = sizes[splitter._inspector_idx]
        main_size = sizes[splitter._main_idx]
        exp_main_size = new_window_size - exp_inspector_size

        exp_main_size -= handle_width // 2
        exp_inspector_size -= handle_width // 2

        assert (inspector_size, main_size) == (exp_inspector_size,
                                               exp_main_size) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:38,代码来源:test_miscwidgets.py


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