void Dialog::draw_needle()
{
needle.setPoints(4, 0,7, 14,0, 160,7, 14,14);
needle.translate((this->width()/2), (this->height()/2)+30 );
painter.
setPen(QPen(QColor(79,
106,
25),
1, Qt
::SolidLine, Qt
::RoundCap, Qt
::RoundJoin));
painter.
setBrush(QColor(122,
163,
39));
painter.drawConvexPolygon(needle);
painter.rotate(45);
}
{
draw_dial();
draw_needle();
}
void Dialog::draw_needle()
{
QPolygon needle;
needle.setPoints(4, 0,7, 14,0, 160,7, 14,14);
needle.translate((this->width()/2), (this->height()/2)+30 );
QPainter painter(this);
painter.setPen(QPen(QColor(79, 106, 25), 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter.setBrush(QColor(122, 163, 39));
painter.drawConvexPolygon(needle);
painter.rotate(45);
}
void Dialog::paintEvent(QPaintEvent *event)
{
draw_dial();
draw_needle();
}
To copy to clipboard, switch view to plain text mode
Bookmarks