Hi everyone,
Currently I am designing a speedometer in Qt. I did read the example which come with Qwt installation package. However, I didn't create the this widget manually, but created it by dragging the Qwtdial widget into my dialog.
Here is my code:
ui->Dial->setScaleArc(0.0, 270.0);
ui->Dial->scaleDraw()->setSpacing(1);
ui->Dial->setScaleTicks(0, 2, 4);
ui->Dial->setRange(0, 160);
ui->Dial->setScale(1, 2, 20);
ui->Dial->scaleDraw()->setPenWidth(1);
ui->Dial->setNeedle(needle);
ui->Dial->setScaleArc(0.0, 270.0);
ui->Dial->scaleDraw()->setSpacing(1);
ui->Dial->setScaleTicks(0, 2, 4);
ui->Dial->setRange(0, 160);
ui->Dial->setScale(1, 2, 20);
QwtDialSimpleNeedle *needle = new QwtDialSimpleNeedle(
QwtDialSimpleNeedle::Arrow, true, Qt::red,
QColor(Qt::gray).light(130));
ui->Dial->scaleDraw()->setPenWidth(1);
ui->Dial->setNeedle(needle);
To copy to clipboard, switch view to plain text mode
My question is how i can add label at the bottom of speedometer?
In the example, it used
SpeedoMeter
::drawScaleContents(QPainter *painter,
const QPoint ¢er,
int radius
) const
SpeedoMeter::drawScaleContents(QPainter *painter,
const QPoint ¢er, int radius) const
To copy to clipboard, switch view to plain text mode
but i don't know how to use in my code.
thanks in advance.
Bookmarks