python类Horizontal()的实例源码

player.py 文件源码 项目:MusicPlayer 作者: HuberTRoy 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
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)
qteditorfactory.py 文件源码 项目:QtPropertyBrowserV2.6-for-pyqt5 作者: theall 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def createEditor(self, manager, property, parent):
        editor = QSlider(Qt.Horizontal, parent)
        self.d_ptr.initializeEditor(property, editor)
        editor.setSingleStep(manager.singleStep(property))
        editor.setRange(manager.minimum(property), manager.maximum(property))
        editor.setValue(manager.value(property))

        editor.valueChanged.connect(self.d_ptr.slotSetValue)
        editor.destroyed.connect(self.d_ptr.slotEditorDestroyed)
        return editor

    ###
    #    \internal
    #
    #    Reimplemented from the QtAbstractEditorFactory class.
    ###
settings.py 文件源码 项目:tvlinker 作者: ozmartian 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, parent, settings: QSettings, f=Qt.WindowCloseButtonHint):
        super(Settings, self).__init__(parent, f)
        self.parent = parent
        self.settings = settings
        self.setWindowModality(Qt.ApplicationModal)
        self.tab_general = GeneralTab(self.settings)
        self.tab_favorites = FavoritesTab(self.settings)
        tabs = QTabWidget()
        tabs.addTab(self.tab_general, 'General')
        tabs.addTab(self.tab_favorites, 'Favorites')
        button_box = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        button_box.accepted.connect(self.save_settings)
        button_box.rejected.connect(self.close)
        layout = QVBoxLayout()
        layout.addWidget(tabs)
        layout.addWidget(button_box)
        self.setLayout(layout)
        self.setWindowTitle('%s Settings' % qApp.applicationName())
        self.setWindowIcon(self.parent.icon_settings)
Slider.py 文件源码 项目:VIRTUAL-PHONE 作者: SumanKanrar-IEM 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def init_ui(self):
        self.le = QLineEdit()
        self.b1 = QPushButton('Clear')
        self.b2 = QPushButton('Print')
        self.s1 = QSlider(Qt.Horizontal)
        self.s1.setMinimum(1)
        self.s1.setMaximum(99)
        self.s1.setValue(25)
        self.s1.setTickInterval(10)
        self.s1.setTickPosition(QSlider.TicksBelow)

        v_box = QVBoxLayout()
        v_box.addWidget(self.le)
        v_box.addWidget(self.b1)
        v_box.addWidget(self.b2)
        v_box.addWidget(self.s1)

        self.setLayout(v_box)
        self.setWindowTitle('PyQt5 Lesson 8')

        self.b1.clicked.connect(lambda: self.btn_clk(self.b1, 'Hello from Clear'))
        self.b2.clicked.connect(lambda: self.btn_clk(self.b2, 'Hello from Print'))
        self.s1.valueChanged.connect(self.v_change)

        self.show()
colormapDialogUi.py 文件源码 项目:Py2DSpectroscopy 作者: SvenBo90 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, colormap_dialog):

        # set window title, object name and window size
        colormap_dialog.setWindowTitle("Choose Colormap")
        colormap_dialog.setObjectName("ColormapDialog")
        colormap_dialog.setFixedWidth(455)
        colormap_dialog.setFixedHeight(100)

        # button box
        self.button_box = QDialogButtonBox(colormap_dialog)
        self.button_box.setEnabled(True)
        self.button_box.setGeometry(QRect(10, 60, 435, 30))
        self.button_box.setOrientation(Qt.Horizontal)
        self.button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
        self.button_box.setObjectName("button_box")

        # colormap selector
        self.colormap_combobox = QComboBox(colormap_dialog)
        self.colormap_combobox.setGeometry(QRect(10, 10, 435, 30))
        self.colormap_combobox.setIconSize(QSize(435, 20))

        # connect accept and reject
        self.button_box.accepted.connect(colormap_dialog.accept)
        self.button_box.rejected.connect(colormap_dialog.reject)
ChoiceDialog.py 文件源码 项目:Cfd 作者: qingfengxia 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, choices, title = "select one from choices", parent = None):
        super(ChoiceDialog, self).__init__(parent)

        layout = QVBoxLayout(self)
        self.choiceButtonGroup=QButtonGroup(parent)  # it is not a visible UI
        self.choiceButtonGroup.setExclusive(True)
        if choices and len(choices)>=1:
            self.choices = choices
            for id, choice in enumerate(self.choices):
                rb = QRadioButton(choice)
                self.choiceButtonGroup.addButton(rb)
                self.choiceButtonGroup.setId(rb, id)  # negative id if not specified
                layout.addWidget(rb)

        self.choiceButtonGroup.buttonClicked.connect(self.choiceChanged)
        # OK and Cancel buttons
        buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
            Qt.Horizontal, self)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        layout.addWidget(buttons)

        self.setLayout(layout)
        self.setWindowTitle(title)
flowlayout.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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()
movie.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def createControls(self):
        self.fitCheckBox = QCheckBox("Fit to Window")

        self.frameLabel = QLabel("Current frame:")

        self.frameSlider = QSlider(Qt.Horizontal)
        self.frameSlider.setTickPosition(QSlider.TicksBelow)
        self.frameSlider.setTickInterval(10)

        speedLabel = QLabel("Speed:")

        self.speedSpinBox = QSpinBox()
        self.speedSpinBox.setRange(1, 9999)
        self.speedSpinBox.setValue(100)
        self.speedSpinBox.setSuffix("%")

        self.controlsLayout = QGridLayout()
        self.controlsLayout.addWidget(self.fitCheckBox, 0, 0, 1, 2)
        self.controlsLayout.addWidget(self.frameLabel, 1, 0)
        self.controlsLayout.addWidget(self.frameSlider, 1, 1, 1, 2)
        self.controlsLayout.addWidget(speedLabel, 2, 0)
        self.controlsLayout.addWidget(self.speedSpinBox, 2, 1)
flowlayout.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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()
movie.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def createControls(self):
        self.fitCheckBox = QCheckBox("Fit to Window")

        self.frameLabel = QLabel("Current frame:")

        self.frameSlider = QSlider(Qt.Horizontal)
        self.frameSlider.setTickPosition(QSlider.TicksBelow)
        self.frameSlider.setTickInterval(10)

        speedLabel = QLabel("Speed:")

        self.speedSpinBox = QSpinBox()
        self.speedSpinBox.setRange(1, 9999)
        self.speedSpinBox.setValue(100)
        self.speedSpinBox.setSuffix("%")

        self.controlsLayout = QGridLayout()
        self.controlsLayout.addWidget(self.fitCheckBox, 0, 0, 1, 2)
        self.controlsLayout.addWidget(self.frameLabel, 1, 0)
        self.controlsLayout.addWidget(self.frameSlider, 1, 1, 1, 2)
        self.controlsLayout.addWidget(speedLabel, 2, 0)
        self.controlsLayout.addWidget(self.speedSpinBox, 2, 1)
get_node_dialog.py 文件源码 项目:opcua-widgets 作者: FreeOpcUa 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, parent, startnode, currentnode=None):
        QDialog.__init__(self, parent)

        layout = QVBoxLayout(self)

        self.treeview = QTreeView(self)
        self.treeview.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.tree = TreeWidget(self.treeview)
        self.tree.set_root_node(startnode)
        layout.addWidget(self.treeview)

        self.buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
            Qt.Horizontal, self)
        layout.addWidget(self.buttons)
        self.resize(800, 600)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)
        self.treeview.activated.connect(self.accept)

        if currentnode:
            self.tree.expand_to_node(currentnode)
first.py 文件源码 项目:FIRST-plugin-ida 作者: vrtadmin 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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
flowlayout.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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()
movie.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def createControls(self):
        self.fitCheckBox = QCheckBox("Fit to Window")

        self.frameLabel = QLabel("Current frame:")

        self.frameSlider = QSlider(Qt.Horizontal)
        self.frameSlider.setTickPosition(QSlider.TicksBelow)
        self.frameSlider.setTickInterval(10)

        speedLabel = QLabel("Speed:")

        self.speedSpinBox = QSpinBox()
        self.speedSpinBox.setRange(1, 9999)
        self.speedSpinBox.setValue(100)
        self.speedSpinBox.setSuffix("%")

        self.controlsLayout = QGridLayout()
        self.controlsLayout.addWidget(self.fitCheckBox, 0, 0, 1, 2)
        self.controlsLayout.addWidget(self.frameLabel, 1, 0)
        self.controlsLayout.addWidget(self.frameSlider, 1, 1, 1, 2)
        self.controlsLayout.addWidget(speedLabel, 2, 0)
        self.controlsLayout.addWidget(self.speedSpinBox, 2, 1)
kp_mission_control.py 文件源码 项目:KerbalPie 作者: Vivero 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def headerData(self, section, orientation, role):
        if role == Qt.DisplayRole:
            if orientation == Qt.Horizontal:
                return QVariant(self._mp_table_header[section])

        return QVariant()
kp_flight_data.py 文件源码 项目:KerbalPie 作者: Vivero 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def headerData(self, section, orientation, role):
        if role == Qt.DisplayRole:
            if orientation == Qt.Horizontal:
                return QVariant(self._flight_data_header[section])
qteditorfactory.py 文件源码 项目:QtPropertyBrowserV2.6-for-pyqt5 作者: theall 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def createEditor(self, manager, property, parent):
        editor = QScrollBar(Qt.Horizontal, parent)
        self.d_ptr.initializeEditor(property, editor)
        editor.setSingleStep(manager.singleStep(property))
        editor.setRange(manager.minimum(property), manager.maximum(property))
        editor.setValue(manager.value(property))
        editor.valueChanged.connect(self.d_ptr.slotSetValue)
        editor.destroyed.connect(self.d_ptr.slotEditorDestroyed)
        return editor

    ###
    #    \internal
    #
    #    Reimplemented from the QtAbstractEditorFactory class.
    ###
Slider.py 文件源码 项目:LearningPyQt 作者: manashmndl 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def init_ui(self):
        # Creating a label
        self.sliderLabel = QLabel('Slider:', self)

        # Creating a slider and setting its maximum and minimum value
        self.slider = QSlider(self)
        self.slider.setMinimum(0)
        self.slider.setMaximum(100)
        self.slider.setOrientation(Qt.Horizontal)

        # Creating a horizontalBoxLayout
        self.hboxLayout = QHBoxLayout(self)

        # Adding the widgets
        self.hboxLayout.addWidget(self.sliderLabel)
        self.hboxLayout.addWidget(self.slider)

        # Setting main layout
        self.setLayout(self.hboxLayout)

        # Setting a connection between slider position change and
        # on_changed_value function
        self.slider.valueChanged.connect(self.on_changed_value)

        self.setWindowTitle("Dialog with a Slider")
        self.show()
DicomBrowser.py 文件源码 项目:DicomBrowser 作者: ericspod 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def headerData(self, section, orientation, role):
        if role == Qt.DisplayRole and orientation==Qt.Horizontal:
            return keywordNameMap[self.seriesColumns[section]]
hpc.py 文件源码 项目:gpvdm 作者: roderickmackenzie 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self):
        QWidget.__init__(self)
        self.hbox=QHBoxLayout()

        self.bar=progress_class()
        self.bar.spinner.stop()
        self.bar.spinner.hide()
        self.label=QLabel()

        self.slider = QSlider(Qt.Horizontal)


        self.slider.setTickPosition(QSlider.TicksBelow)
        self.slider.setTickInterval(1)
        #self.slider.valueChanged.connect(self.slider0_change)
        self.slider.setMinimumSize(300, 80)
        self.slider.valueChanged.connect(self.slider_changed)
        self.slider.setTickPosition(QSlider.TicksBelow)
        self.hbox.addWidget(self.label)
        self.hbox.addWidget(self.bar)
        self.hbox.addWidget(self.slider)

        self.setLayout(self.hbox)

        self.name=""
        self.ip=""
        self.cpus=-1
        self.load=-1
        self.max_cpus=-1
        self.last_seen=-1
ItemModelLineChart.py 文件源码 项目:pyqt5 作者: yurisnm 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def headerData(self, section, orientation, role=None):
        if role == Qt.DisplayRole:
            return QVariant()
        if orientation == Qt.Horizontal:
            if section%2==0:
                return "x"
            else:
                return "y"
        else:
            return "{}".format(section+1)
LineChart.py 文件源码 项目:pyqt5 作者: yurisnm 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def headerData(self, section, orientation, role=None):
        print(orientation)
        if role == Qt.DisplayRole:
            return QVariant()
        if orientation == Qt.Horizontal:
            if section%2==0:
                return "x"
            else:
                return "y"
        else:
            return "{}".format(section+1)
listView.py 文件源码 项目:defconQt 作者: trufont 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def headerData(self, section, orientation, role=Qt.DisplayRole):
        if role == Qt.DisplayRole and orientation == Qt.Horizontal:
            if section >= len(self._headerLabels):
                return None
            else:
                return self._headerLabels[section]
        return super(AbstractListModel, self).headerData(section, orientation, role)
memory_model.py 文件源码 项目:pysport 作者: sportorg 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def headerData(self, index, orientation, role=None):
        if role == Qt.DisplayRole:
            if orientation == Qt.Horizontal:
                columns = self.get_headers()
                return _(columns[index])
            if orientation == Qt.Vertical:
                return str(index+1)
treemodel.py 文件源码 项目:crispy 作者: mretegan 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def headerData(self, section, orientation, role):
        """Return the data for the given role and section in the header
        with the specified orientation.
        """
        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
            return self.header[section]
framecapture.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self):
        super(FrameCapture, self).__init__()

        self._percent = 0
        self._page = QWebPage()
        self._page.mainFrame().setScrollBarPolicy(Qt.Vertical,
                Qt.ScrollBarAlwaysOff)
        self._page.mainFrame().setScrollBarPolicy(Qt.Horizontal,
                Qt.ScrollBarAlwaysOff)
        self._page.loadProgress.connect(self.printProgress)
        self._page.loadFinished.connect(self.saveResult)
borderlayout.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def expandingDirections(self):
        return Qt.Horizontal | Qt.Vertical
simpletreemodel.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def headerData(self, section, orientation, role):
        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
            return self.rootItem.data(section)

        return None
simpledommodel.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def headerData(self, section, orientation, role):
        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
            if section == 0:
                return "Name"

            if section == 1:
                return "Attributes"

            if section == 2:
                return "Value"

        return None
grabber.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def createSlider(self, changedSignal, setterSlot):
        slider = QSlider(Qt.Horizontal)
        slider.setRange(0, 360 * 16)
        slider.setSingleStep(16)
        slider.setPageStep(15 * 16)
        slider.setTickInterval(15 * 16)
        slider.setTickPosition(QSlider.TicksRight)

        slider.valueChanged.connect(setterSlot)
        changedSignal.connect(slider.setValue)

        return slider


问题


面经


文章

微信
公众号

扫码关注公众号