29  setMinimumSize( QSize( 50, 50 ) );
 
 
   34  QDial::paintEvent( event );
 
   35  QPainter painter( 
this );
 
   36  const QRect rect = geometry();
 
   37  painter.setPen( QPen( palette().color( QPalette::WindowText ) ) );
 
   38  painter.drawText( QRectF( 0, rect.height() * 0.65, rect.width(), rect.height() ),
 
 
   75  if ( mMin.userType() == QMetaType::Type::Int &&
 
   76       mMax.userType() == QMetaType::Type::Int &&
 
   77       mStep.userType() == QMetaType::Type::Int &&
 
   78       mValue.userType() == QMetaType::Type::Int )
 
   80    QDial::setMinimum( mMin.toInt() );
 
   81    QDial::setMaximum( mMax.toInt() );
 
   82    QDial::setSingleStep( mStep.toInt() );
 
   83    QDial::setValue( mValue.toInt() );
 
   86  if ( mMin.userType() == QMetaType::Type::Double &&
 
   87       mMax.userType() == QMetaType::Type::Double &&
 
   88       mStep.userType() == QMetaType::Type::Double &&
 
   89       mValue.userType() == QMetaType::Type::Double )
 
   92      QDial::setMinimum( 0 );
 
   94    const int max = std::ceil( ( mMax.toDouble() - mMin.toDouble() ) / mStep.toDouble() );
 
   95    if ( maximum() != max )
 
   96      QDial::setMaximum( max );
 
   98    if ( singleStep() != 1 )
 
   99      QDial::setSingleStep( 1 );
 
  101    QDial::setValue( std::ceil( ( mValue.toDouble() - mMin.toDouble() ) / mStep.toDouble() ) );
 
  104  connect( 
this, 
static_cast < void ( QDial::* )( 
int ) 
> ( &QDial::valueChanged ), 
this, &QgsDial::onValueChanged );
 
  112void QgsDial::onValueChanged( 
int value )
 
  118  else if ( mMin.userType() == QMetaType::Type::Int &&
 
  119            mMax.userType() == QMetaType::Type::Int &&
 
  120            mStep.userType() == QMetaType::Type::Int &&
 
  121            mValue.userType() == QMetaType::Type::Int )
 
  125  else if ( mMin.userType() == QMetaType::Type::Double &&
 
  126            mMax.userType() == QMetaType::Type::Double &&
 
  127            mStep.userType() == QMetaType::Type::Double &&
 
  128            mValue.userType() == QMetaType::Type::Double )
 
  130    mValue = QVariant( mMin.toDouble() + value * mStep.toDouble() );
 
QgsDial(QWidget *parent=nullptr)
Constructor for QgsDial.
 
void valueChanged(const QVariant &)
 
void setSingleStep(const QVariant &step)
 
void setValue(const QVariant &value)
 
QVariant variantValue() const
 
void paintEvent(QPaintEvent *event) override
 
void setMinimum(const QVariant &min)
 
void setMaximum(const QVariant &max)
 
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
Returns true if the specified variant should be considered a NULL value.