You are not logged in.

Dear visitor, welcome to If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.


Wednesday, November 9th 2016, 6:08am

QWT Dials


I'm new in Qt. I installed QWT and I would like to control one of the QWT dials and change its value by using spinbox. This is a part from the dial code:

QwtCompass *Dial::createCompass(int pos)


int c;

QPalette palette0;

QwtCompass *compass = new QwtCompass( this );

compass->setLineWidth( 4 );


A compass without a frame, showing numbers as tick labels.

The origin is at 220.0


palette0.setColor( QPalette::Base,

palette().color( backgroundRole() ) );

palette0.setColor( QPalette::WindowText, Qt::blue );

compass->setLineWidth( 0 );

QMap<double, QString> map;

for ( double d = 0; d < 360.0; d += 90.0 )


QString label;

label.sprintf( "%.0f", d );

qDebug()<< d;

map.insert( d, label );


QwtCompassScaleDraw *scaleDraw =

new QwtCompassScaleDraw( map );

scaleDraw->enableComponent( QwtAbstractScaleDraw::Ticks, true );

compass->setScaleDraw( scaleDraw );

compass->setNeedle( new QwtDialSimpleNeedle( QwtDialSimpleNeedle::Ray,

true, Qt::white ) );

compass->setOrigin( 270 );//220.0


I just need to understand how can I control the needle to present the value that is selected in the spin box!!
Also, I want the dial to present a value from -90 to +180. How can I change that? which value should I add instead of "%.0f" because it force the dial to represent a positive value only?

Thanks in advance.

Similar threads