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


Python QtWidgets.QDial类代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QDial的典型用法代码示例。如果您正苦于以下问题:Python QDial类的具体用法?Python QDial怎么用?Python QDial使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setValue

    def setValue(self, value):
        if self.fRealValue == value:
            return

        self.fRealValue = value
        normValue = float(value - self.fMinimum) / float(self.fMaximum - self.fMinimum)
        QDial.setValue(self, int(normValue * 10000))
开发者ID:,项目名称:,代码行数:7,代码来源:

示例2: createBottomRightGroupBox

    def createBottomRightGroupBox(self):
        self.bottomRightGroupBox = QGroupBox("Group 3")
        self.bottomRightGroupBox.setCheckable(True)
        self.bottomRightGroupBox.setChecked(True)

        lineEdit = QLineEdit('s3cRe7')
        lineEdit.setEchoMode(QLineEdit.Password)

        spinBox = QSpinBox(self.bottomRightGroupBox)
        spinBox.setValue(50)

        dateTimeEdit = QDateTimeEdit(self.bottomRightGroupBox)
        dateTimeEdit.setDateTime(QDateTime.currentDateTime())

        slider = QSlider(Qt.Horizontal, self.bottomRightGroupBox)
        slider.setValue(40)

        scrollBar = QScrollBar(Qt.Horizontal, self.bottomRightGroupBox)
        scrollBar.setValue(60)

        dial = QDial(self.bottomRightGroupBox)
        dial.setValue(30)
        dial.setNotchesVisible(True)

        layout = QGridLayout()
        layout.addWidget(lineEdit, 0, 0, 1, 2)
        layout.addWidget(spinBox, 1, 0, 1, 2)
        layout.addWidget(dateTimeEdit, 2, 0, 1, 2)
        layout.addWidget(slider, 3, 0)
        layout.addWidget(scrollBar, 4, 0)
        layout.addWidget(dial, 3, 1, 2, 1)
        layout.setRowStretch(5, 1)
        self.bottomRightGroupBox.setLayout(layout)
开发者ID:death-finger,项目名称:Scripts,代码行数:33,代码来源:styles.py

示例3: __init__

	def __init__(self, parent, update_callback):
		QWidget.__init__(self, parent)
		self.layout = QGridLayout()
		self.setLayout(self.layout)
		self.update_callback = update_callback


		self.light_value = QSlider(self)
		self.hue_value = QDial(self)
		self.saturation_value = QDial(self)
		self.monitor = Monitor(self)

		self.layout.addWidget(QLabel('Hue'), 0, 0, Qt.AlignHCenter)
		self.layout.addWidget(self.hue_value, 1, 0, Qt.AlignHCenter)
		self.layout.addWidget(QLabel('Saturation'), 2, 0, Qt.AlignHCenter)
		self.layout.addWidget(self.saturation_value, 3, 0, Qt.AlignHCenter)
		self.layout.addWidget(self.monitor, 4, 0, Qt.AlignHCenter)
		self.layout.addWidget(QLabel('Intensity'), 5, 0, Qt.AlignHCenter)
		self.layout.addWidget(self.light_value, 6, 0, Qt.AlignHCenter)

		self.update()

		self.hue_value.valueChanged.connect(self.update)
		self.saturation_value.valueChanged.connect(self.update)
		self.light_value.valueChanged.connect(self.update)
开发者ID:ledalert,项目名称:led-nekrosfilm-sw,代码行数:25,代码来源:ljusbord.py

示例4: paintEvent

 def paintEvent(self, event):
     painter = QPainter(self)
     font = painter.font()
     font.setPointSize(self.width() / 6.0)
     painter.setFont(font)
     painter.drawText(self.rect(), Qt.AlignCenter | Qt.AlignVCenter, str(self.value()))
     QDial.paintEvent(self, event)
开发者ID:estan,项目名称:gauges,代码行数:7,代码来源:gauge.py

示例5: initUI

    def initUI(self):
        self.combo = QComboBox(self)
        self.combo.move(10, 10)
        self.combo.activated[str].connect(self.onActivated)

        refresh = QPushButton("Refresh", self)
        refresh.move(10, 40)
        refresh.clicked.connect(self.refreshClicked)

        # sld = QSlider(Qt.Horizontal, self)
        # sld.setFocusPolicy(Qt.NoFocus)
        # sld.setGeometry(30, 40, 150, 30)

        sld = QDial(self)
        sld.setRange(0, 360)
        sld.move(10, 70)
        sld.valueChanged[int].connect(self.changeValue)

        self.motorAngle = QLabel("Angle: 000", self)
        self.motorAngle.move(120, 110)

        self.status = QLabel("Select a COM", self)
        self.status.move(10, 180)

        self.setGeometry(200, 200, 200, 200)
        self.setWindowTitle("Motor Control")

        self.combo.addItem("Connect/Refresh")
        self.show()
        self.addPorts()

        self.positionGraph = AnalogPosition()
        self.positionGraph.show()
开发者ID:TOCyna,项目名称:plaquinha,代码行数:33,代码来源:motorControl.py

示例6: setEnabled

    def setEnabled(self, enabled):
        if self.isEnabled() == enabled:
            return

        QDial.setEnabled(self, enabled)

        self.fPixmap.load(":/bitmaps/dial_%s%s.png" % (self.fPixmapNum, "" if enabled else "d"))
        self.updateSizes()
        self.update()
开发者ID:xuanvu,项目名称:Carla,代码行数:9,代码来源:pixmapdial.py

示例7: SlidersGroup

class SlidersGroup(QGroupBox):

    valueChanged = pyqtSignal(int)

    def __init__(self, orientation, title, parent=None):
        super(SlidersGroup, self).__init__(title, parent)

        self.slider = QSlider(orientation)
        self.slider.setFocusPolicy(Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setTickInterval(10)
        self.slider.setSingleStep(1)

        self.scrollBar = QScrollBar(orientation)
        self.scrollBar.setFocusPolicy(Qt.StrongFocus)

        self.dial = QDial()
        self.dial.setFocusPolicy(Qt.StrongFocus)

        self.slider.valueChanged.connect(self.scrollBar.setValue)
        self.scrollBar.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)
        self.dial.valueChanged.connect(self.valueChanged)

        if orientation == Qt.Horizontal:
            direction = QBoxLayout.TopToBottom
        else:
            direction = QBoxLayout.LeftToRight

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(self.slider)
        slidersLayout.addWidget(self.scrollBar)
        slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)    

    def setValue(self, value):    
        self.slider.setValue(value)    

    def setMinimum(self, value):    
        self.slider.setMinimum(value)
        self.scrollBar.setMinimum(value)
        self.dial.setMinimum(value)    

    def setMaximum(self, value):    
        self.slider.setMaximum(value)
        self.scrollBar.setMaximum(value)
        self.dial.setMaximum(value)    

    def invertAppearance(self, invert):
        self.slider.setInvertedAppearance(invert)
        self.scrollBar.setInvertedAppearance(invert)
        self.dial.setInvertedAppearance(invert)    

    def invertKeyBindings(self, invert):
        self.slider.setInvertedControls(invert)
        self.scrollBar.setInvertedControls(invert)
        self.dial.setInvertedControls(invert)
开发者ID:death-finger,项目名称:Scripts,代码行数:57,代码来源:sliders.py

示例8: __init__

    def __init__(self, orientation, title, parent=None):
        super(SlidersGroup, self).__init__(title, parent)

        self.slider = QSlider(orientation)
        self.slider.setFocusPolicy(Qt.StrongFocus)
        self.slider.setTickPosition(QSlider.TicksBothSides)
        self.slider.setTickInterval(10)
        self.slider.setSingleStep(1)

        self.scrollBar = QScrollBar(orientation)
        self.scrollBar.setFocusPolicy(Qt.StrongFocus)

        self.dial = QDial()
        self.dial.setFocusPolicy(Qt.StrongFocus)

        self.slider.valueChanged.connect(self.scrollBar.setValue)
        self.scrollBar.valueChanged.connect(self.dial.setValue)
        self.dial.valueChanged.connect(self.slider.setValue)
        self.dial.valueChanged.connect(self.valueChanged)

        if orientation == Qt.Horizontal:
            direction = QBoxLayout.TopToBottom
        else:
            direction = QBoxLayout.LeftToRight

        slidersLayout = QBoxLayout(direction)
        slidersLayout.addWidget(self.slider)
        slidersLayout.addWidget(self.scrollBar)
        slidersLayout.addWidget(self.dial)
        self.setLayout(slidersLayout)    
开发者ID:death-finger,项目名称:Scripts,代码行数:30,代码来源:sliders.py

示例9: mousePressEvent

    def mousePressEvent(self, event):
        if self.fDialMode == self.MODE_DEFAULT:
            return QDial.mousePressEvent(self, event)

        if event.button() == Qt.LeftButton:
            self.fIsPressed = True
            self.fLastDragPos = event.pos()
            self.fLastDragValue = self.fRealValue
开发者ID:falkTX,项目名称:Carla,代码行数:8,代码来源:pixmapdial.py

示例10: __init__

    def __init__(self, parent, index=0):
        QDial.__init__(self, parent)

        self.fMinimum   = 0.0
        self.fMaximum   = 1.0
        self.fRealValue = 0.0

        self.fIsHovered = False
        self.fHoverStep = self.HOVER_MIN

        self.fIndex     = index
        self.fPixmap    = QPixmap(":/bitmaps/dial_01d.png")
        self.fPixmapNum = "01"

        if self.fPixmap.width() > self.fPixmap.height():
            self.fPixmapOrientation = self.HORIZONTAL
        else:
            self.fPixmapOrientation = self.VERTICAL

        self.fLabel     = ""
        self.fLabelPos  = QPointF(0.0, 0.0)
        self.fLabelFont = QFont(self.font())
        self.fLabelFont.setPointSize(6)
        self.fLabelWidth  = 0
        self.fLabelHeight = 0

        if self.palette().window().color().lightness() > 100:
            # Light background
            c = self.palette().dark().color()
            self.fLabelGradientColor1 = c
            self.fLabelGradientColor2 = QColor(c.red(), c.green(), c.blue(), 0)
            self.fLabelGradientColorT = [self.palette().buttonText().color(), self.palette().mid().color()]
        else:
            # Dark background
            self.fLabelGradientColor1 = QColor(0, 0, 0, 255)
            self.fLabelGradientColor2 = QColor(0, 0, 0, 0)
            self.fLabelGradientColorT = [Qt.white, Qt.darkGray]

        self.fLabelGradient = QLinearGradient(0, 0, 0, 1)
        self.fLabelGradient.setColorAt(0.0, self.fLabelGradientColor1)
        self.fLabelGradient.setColorAt(0.6, self.fLabelGradientColor1)
        self.fLabelGradient.setColorAt(1.0, self.fLabelGradientColor2)

        self.fLabelGradientRect = QRectF(0.0, 0.0, 0.0, 0.0)

        self.fCustomPaintMode  = self.CUSTOM_PAINT_MODE_NULL
        self.fCustomPaintColor = QColor(0xff, 0xff, 0xff)

        self.updateSizes()

        # Fake internal value, 10'000 precision
        QDial.setMinimum(self, 0)
        QDial.setMaximum(self, 10000)
        QDial.setValue(self, 0)

        self.valueChanged.connect(self.slot_valueChanged)
开发者ID:,项目名称:,代码行数:56,代码来源:

示例11: createEditor

    def createEditor(self, parent, option, index):
        editor = QDial(parent=parent)
        editor.setRange(-5, 5)
        editor.setNotchesVisible(True)
        editor.setAutoFillBackground(True)

        return editor
开发者ID:jeremiedecock,项目名称:snippets,代码行数:7,代码来源:widget_QTableView_delegate_on_edit_using_dial_widget.py

示例12: LightChannel

class LightChannel(QWidget):
	changed = pyqtSignal(object)
	def __init__(self, parent, update_callback):
		QWidget.__init__(self, parent)
		self.layout = QGridLayout()
		self.setLayout(self.layout)
		self.update_callback = update_callback


		self.light_value = QSlider(self)
		self.hue_value = QDial(self)
		self.saturation_value = QDial(self)
		self.monitor = Monitor(self)

		self.layout.addWidget(QLabel('Hue'), 0, 0, Qt.AlignHCenter)
		self.layout.addWidget(self.hue_value, 1, 0, Qt.AlignHCenter)
		self.layout.addWidget(QLabel('Saturation'), 2, 0, Qt.AlignHCenter)
		self.layout.addWidget(self.saturation_value, 3, 0, Qt.AlignHCenter)
		self.layout.addWidget(self.monitor, 4, 0, Qt.AlignHCenter)
		self.layout.addWidget(QLabel('Intensity'), 5, 0, Qt.AlignHCenter)
		self.layout.addWidget(self.light_value, 6, 0, Qt.AlignHCenter)

		self.update()

		self.hue_value.valueChanged.connect(self.update)
		self.saturation_value.valueChanged.connect(self.update)
		self.light_value.valueChanged.connect(self.update)


	def get_rgb(self):
		saturation = self.saturation_value.value()/99.0
		light = self.light_value.value()/99.0
		hue = self.hue_value.value()/99.0

		return colorsys.hsv_to_rgb(hue, saturation, light)

	def update(self):
		r, g, b = self.get_rgb()
		self.monitor.setColor(r, g, b)
		self.update_callback.setColor(r, g, b)
		self.changed.emit(self)
开发者ID:ledalert,项目名称:led-nekrosfilm-sw,代码行数:41,代码来源:ljusbord.py

示例13: setValue

    def setValue(self, value, emitSignal=False):
        if self.fRealValue == value:
            return

        if value <= self.fMinimum:
            qtValue = 0
            self.fRealValue = self.fMinimum

        elif value >= self.fMaximum:
            qtValue = self.fPrecision
            self.fRealValue = self.fMaximum

        else:
            qtValue = round(float(value - self.fMinimum) / float(self.fMaximum - self.fMinimum) * self.fPrecision)
            self.fRealValue = value

        # Block change signal, we'll handle it ourselves
        self.blockSignals(True)
        QDial.setValue(self, qtValue)
        self.blockSignals(False)

        if emitSignal:
            self.realValueChanged.emit(self.fRealValue)
开发者ID:falkTX,项目名称:Carla,代码行数:23,代码来源:pixmapdial.py

示例14: mouseMoveEvent

    def mouseMoveEvent(self, event):
        if self.fDialMode == self.MODE_DEFAULT:
            return QDial.mouseMoveEvent(self, event)

        if not self.fIsPressed:
            return

        range = (self.fMaximum - self.fMinimum) / 4.0
        pos   = event.pos()
        dx    = range * float(pos.x() - self.fLastDragPos.x()) / self.width()
        dy    = range * float(pos.y() - self.fLastDragPos.y()) / self.height()
        value = self.fLastDragValue + dx - dy

        if value < self.fMinimum:
            value = self.fMinimum
        elif value > self.fMaximum:
            value = self.fMaximum
        elif self.fIsInteger:
            value = float(round(value))

        self.setValue(value, True)
开发者ID:falkTX,项目名称:Carla,代码行数:21,代码来源:pixmapdial.py

示例15: setPrecision

 def setPrecision(self, value, isInteger):
     self.fPrecision = value
     self.fIsInteger = isInteger
     QDial.setMaximum(self, value)
开发者ID:falkTX,项目名称:Carla,代码行数:4,代码来源:pixmapdial.py


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