本文整理匯總了Python中PyQt5.QtWidgets.QDial.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python QDial.__init__方法的具體用法?Python QDial.__init__怎麽用?Python QDial.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets.QDial
的用法示例。
在下文中一共展示了QDial.__init__方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QDial [as 別名]
# 或者: from PyQt5.QtWidgets.QDial import __init__ [as 別名]
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)