QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qgsslider.cpp
Go to the documentation of this file.
1 #include "qgsslider.h"
2 
3 #include <QRect>
4 
5 QgsSlider::QgsSlider( QWidget * parent ) : QSlider( parent )
6 {
7  setMinimumSize( QSize( 100, 40 ) );
8 }
9 
10 QgsSlider::QgsSlider( Qt::Orientation orientation, QWidget * parent ) : QSlider( orientation, parent )
11 {
12  setMinimumSize( QSize( 100, 40 ) );
13 }
14 
15 void QgsSlider::paintEvent( QPaintEvent *event )
16 {
17  QSlider::paintEvent( event );
18  QPainter painter( this );
19  QRect rect = geometry();
20  painter.setPen( QPen( palette().color( QPalette::WindowText ) ) );
21  painter.drawText( QRectF( 0, rect.height() * 0.5, rect.width(), rect.height() ),
22  Qt::AlignHCenter, QString::number( value() ), 0 );
23  painter.end();
24 }
QgsSlider(QWidget *parent=0)
Definition: qgsslider.cpp:5
virtual void paintEvent(QPaintEvent *event)
Definition: qgsslider.cpp:15