Skip to content
Permalink
Browse files
Add class QgsComposerRuler
  • Loading branch information
mhugent committed Jan 28, 2013
1 parent 4cbec18 commit 7c2c73b4f50c374f4ac713d503563f1932700e0b
Showing with 55 additions and 0 deletions.
  1. +1 −0 src/gui/CMakeLists.txt
  2. +26 −0 src/gui/qgscomposerruler.cpp
  3. +28 −0 src/gui/qgscomposerruler.h
@@ -51,6 +51,7 @@ qgslegendinterface.cpp
qgscharacterselectdialog.cpp
qgscolorbutton.cpp
qgscomposerview.cpp
qgscomposerruler.cpp
qgscursors.cpp
qgsdetaileditemdelegate.cpp
qgsdetaileditemwidget.cpp
@@ -0,0 +1,26 @@
#include "qgscomposerruler.h"
#include <QPainter>

const int RULER_MIN_SIZE = 20;

QgsComposerRuler::QgsComposerRuler( QgsComposerRuler::Direction d ): mDirection( d )
{
}

QgsComposerRuler::~QgsComposerRuler()
{
}

QSize QgsComposerRuler::minimumSizeHint() const
{
return QSize( RULER_MIN_SIZE, RULER_MIN_SIZE );
}

void QgsComposerRuler::paintEvent( QPaintEvent* event )
{
Q_UNUSED( event );

//draw blue rectangle for a test
QPainter p( this );
p.fillRect( rect(), QColor( 0, 0, 255 ) );
}
@@ -0,0 +1,28 @@
#ifndef QGSCOMPOSERRULER_H
#define QGSCOMPOSERRULER_H

#include <QWidget>

/**A class to show paper scale and the current cursor position*/
class QgsComposerRuler: public QWidget
{
public:
enum Direction
{
Horizontal = 0,
Vertical
};

QgsComposerRuler( QgsComposerRuler::Direction d );
~QgsComposerRuler();

QSize minimumSizeHint() const;

protected:
void paintEvent( QPaintEvent* event );

private:
Direction mDirection;
};

#endif // QGSCOMPOSERRULER_H

0 comments on commit 7c2c73b

Please sign in to comment.