QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsdial.cpp
Go to the documentation of this file.
1 #include "qgsdial.h"
2 
3 #include <QRect>
4 
5 QgsDial::QgsDial( QWidget *parent ) : QDial( parent )
6 {
7  setMinimumSize( QSize( 50, 50 ) );
8 }
9 
10 void QgsDial::paintEvent( QPaintEvent *event )
11 {
12  QDial::paintEvent( event );
13  QPainter painter( this );
14  QRect rect = geometry();
15  painter.setPen( QPen( palette().color( QPalette::WindowText ) ) );
16  painter.drawText( QRectF( 0, rect.height() * 0.65, rect.width(), rect.height() ),
17  Qt::AlignHCenter, QString::number( value() ), 0 );
18  painter.end();
19 }