-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ) ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |