Example #1
0
    def __init__(self, label="", parent=None):
        """
        :type parent: QtWidgets.QMenu
        """
        QtWidgets.QWidgetAction.__init__(self, parent)

        self.widget = frame.QFrame(parent)
        self.label = QtWidgets.QLabel(label, self.widget)

        self._slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self.widget)
        self._slider.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                   QtWidgets.QSizePolicy.Expanding)

        self.valueChanged = self._slider.valueChanged
Example #2
0
    def __init__(self, min_=0, max_=100, parent=None):
        super(SpinboxSlider, self).__init__(parent=parent)
        self.range = (min_, max_)

        hbox = QtWidgets.QHBoxLayout(self)

        self.slider = QtWidgets.QSlider(parent=self)
        hbox.addWidget(self.slider)
        self.slider.setOrientation(QtCore.Qt.Horizontal)
        self.slider.setRange(*self.range)

        self.spinbox = QtWidgets.QSpinBox(parent=self)
        hbox.addWidget(self.spinbox)
        self.spinbox.setRange(*self.range)

        self.slider.valueChanged.connect(partial(self.onUpdate, self.spinbox))
        self.spinbox.valueChanged.connect(partial(self.onUpdate, self.slider))
Example #3
0
    def __init__(self, model, parent=None):
        super(NumericAttributeWidget, self).__init__(parent=parent)
        self.model = weakref.ref(model)
        layout = QtWidgets.QHBoxLayout()
        layout.setSpacing(1)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        self.slider = QtWidgets.QSlider(QtCore.Qt.Horizontal, parent=self)
        self.valueSpinBox = QtWidgets.QSpinBox(parent=self)
        self.valueSpinBox.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.valueSpinBox.setRange(-100, 100)
        self.valueSpinBox.setSingleStep(1)
        self.valueSpinBox.valueChanged.connect(self.setValue)
        self.slider.valueChanged.connect(self.setValue)
        # self.valueSpinBox.valueChanged.connect(self.valueChanged.emit)
        layout.addWidget(self.slider)
        layout.addWidget(self.valueSpinBox)
        self.setStyleSheet("""
    QSlider::groove:horizontal
    {
        border:none;
    }

    QSlider::sub-page
    {
        background: rgb(164, 192, 2);
    }

    QSlider::add-page
    {
        background: rgb(70, 70, 70);
    }

    QSlider::handle
    {
        background: rgb(164, 192, 2);
        width: 30px;
        margin: -30px 0;
    }
            """)