QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
QgsComposerRuler Class Reference

A class to show paper scale and the current cursor position. More...

#include <qgscomposerruler.h>

Collaboration diagram for QgsComposerRuler:
Collaboration graph
[legend]

Public Types

enum  Direction { Horizontal = 0, Vertical }

Signals

void cursorPosChanged (QPointF)
 Is emitted when mouse cursor coordinates change.

Public Member Functions

 QgsComposerRuler (QgsComposerRuler::Direction d)
 ~QgsComposerRuler ()
QSize minimumSizeHint () const
void setSceneTransform (const QTransform &transform)
void updateMarker (const QPointF &pos)
void setComposition (QgsComposition *c)
QgsCompositioncomposition ()
int rulerSize ()

Protected Member Functions

void paintEvent (QPaintEvent *event)
void mouseMoveEvent (QMouseEvent *event)
void mouseReleaseEvent (QMouseEvent *event)
void mousePressEvent (QMouseEvent *event)

Private Member Functions

void setSnapLinePosition (const QPointF &pos)
int optimumScale (double minPixelDiff, int &magnitude, int &multiple)
int optimumNumberDivisions (double rulerScale, int scaleMultiple)
void drawRotatedText (QPainter *painter, QPointF pos, const QString &text)
void drawSmallDivisions (QPainter *painter, double startPos, int numDivisions, double rulerScale, double maxPos=0)
void drawMarkerPos (QPainter *painter)

Private Attributes

Direction mDirection
QTransform mTransform
QPointF mMarkerPos
QgsCompositionmComposition
QGraphicsLineItem * mLineSnapItem
QList< QPair< QgsComposerItem
*, QgsComposerItem::ItemPositionMode > > 
mSnappedItems
QFont * mRulerFont
QFontMetrics * mRulerFontMetrics
double mScaleMinPixelsWidth
int mRulerMinSize
int mMinPixelsPerDivision
int mPixelsBetweenLineAndText
int mTextBaseline
int mMinSpacingVerticalLabels

Static Private Attributes

static const int validScaleMultiples [] = {1, 2, 5}
static const int validScaleMagnitudes [] = {1, 10, 100, 1000, 10000}

Detailed Description

A class to show paper scale and the current cursor position.

Definition at line 10 of file qgscomposerruler.h.

Member Enumeration Documentation

Enumerator:
Horizontal 
Vertical 

Definition at line 15 of file qgscomposerruler.h.

Constructor & Destructor Documentation

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

Definition at line 45 of file qgscomposerruler.cpp.

References mRulerFont, and mRulerFontMetrics.

Member Function Documentation

QgsComposition* QgsComposerRuler::composition ( )
inline

Definition at line 30 of file qgscomposerruler.h.

void QgsComposerRuler::cursorPosChanged ( QPointF  )
signal

Is emitted when mouse cursor coordinates change.

Referenced by mouseMoveEvent().

void QgsComposerRuler::drawMarkerPos ( QPainter *  painter)
private

Definition at line 212 of file qgscomposerruler.cpp.

References Horizontal, mDirection, mMarkerPos, and mRulerMinSize.

Referenced by paintEvent().

void QgsComposerRuler::drawRotatedText ( QPainter *  painter,
QPointF  pos,
const QString &  text 
)
private

Definition at line 226 of file qgscomposerruler.cpp.

Referenced by paintEvent().

void QgsComposerRuler::drawSmallDivisions ( QPainter *  painter,
double  startPos,
int  numDivisions,
double  rulerScale,
double  maxPos = 0 
)
private

Definition at line 235 of file qgscomposerruler.cpp.

References Horizontal, mDirection, mRulerMinSize, and mTransform.

Referenced by paintEvent().

QSize QgsComposerRuler::minimumSizeHint ( ) const

Definition at line 51 of file qgscomposerruler.cpp.

References mRulerMinSize.

void QgsComposerRuler::mouseMoveEvent ( QMouseEvent *  event)
protected
void QgsComposerRuler::mousePressEvent ( QMouseEvent *  event)
protected
void QgsComposerRuler::mouseReleaseEvent ( QMouseEvent *  event)
protected
int QgsComposerRuler::optimumNumberDivisions ( double  rulerScale,
int  scaleMultiple 
)
private

Definition at line 313 of file qgscomposerruler.cpp.

References mMinPixelsPerDivision, and mTransform.

Referenced by paintEvent().

int QgsComposerRuler::optimumScale ( double  minPixelDiff,
int &  magnitude,
int &  multiple 
)
private
void QgsComposerRuler::paintEvent ( QPaintEvent *  event)
protected
int QgsComposerRuler::rulerSize ( )
inline

Definition at line 32 of file qgscomposerruler.h.

void QgsComposerRuler::setComposition ( QgsComposition c)
inline

Definition at line 29 of file qgscomposerruler.h.

Referenced by QgsComposerView::setComposition().

void QgsComposerRuler::setSceneTransform ( const QTransform &  transform)

Definition at line 358 of file qgscomposerruler.cpp.

References mTransform.

Referenced by QgsComposerView::updateRulers().

void QgsComposerRuler::setSnapLinePosition ( const QPointF &  pos)
private
void QgsComposerRuler::updateMarker ( const QPointF &  pos)
inline

Definition at line 27 of file qgscomposerruler.h.

Referenced by mouseMoveEvent(), and QgsComposerView::mouseMoveEvent().

Member Data Documentation

QgsComposition* QgsComposerRuler::mComposition
private
Direction QgsComposerRuler::mDirection
private
QGraphicsLineItem* QgsComposerRuler::mLineSnapItem
private

Definition at line 48 of file qgscomposerruler.h.

Referenced by mousePressEvent(), mouseReleaseEvent(), and setSnapLinePosition().

QPointF QgsComposerRuler::mMarkerPos
private

Definition at line 46 of file qgscomposerruler.h.

Referenced by drawMarkerPos().

int QgsComposerRuler::mMinPixelsPerDivision
private

Definition at line 56 of file qgscomposerruler.h.

Referenced by optimumNumberDivisions(), and QgsComposerRuler().

int QgsComposerRuler::mMinSpacingVerticalLabels
private

Definition at line 59 of file qgscomposerruler.h.

Referenced by paintEvent(), and QgsComposerRuler().

int QgsComposerRuler::mPixelsBetweenLineAndText
private

Definition at line 57 of file qgscomposerruler.h.

Referenced by paintEvent(), and QgsComposerRuler().

QFont* QgsComposerRuler::mRulerFont
private

Definition at line 52 of file qgscomposerruler.h.

Referenced by paintEvent(), QgsComposerRuler(), and ~QgsComposerRuler().

QFontMetrics* QgsComposerRuler::mRulerFontMetrics
private

Definition at line 53 of file qgscomposerruler.h.

Referenced by paintEvent(), QgsComposerRuler(), and ~QgsComposerRuler().

int QgsComposerRuler::mRulerMinSize
private
double QgsComposerRuler::mScaleMinPixelsWidth
private

Definition at line 54 of file qgscomposerruler.h.

Referenced by paintEvent(), and QgsComposerRuler().

QList< QPair< QgsComposerItem*, QgsComposerItem::ItemPositionMode > > QgsComposerRuler::mSnappedItems
private

Definition at line 50 of file qgscomposerruler.h.

Referenced by mousePressEvent(), mouseReleaseEvent(), and setSnapLinePosition().

int QgsComposerRuler::mTextBaseline
private

Definition at line 58 of file qgscomposerruler.h.

Referenced by paintEvent(), and QgsComposerRuler().

QTransform QgsComposerRuler::mTransform
private
const int QgsComposerRuler::validScaleMagnitudes = {1, 10, 100, 1000, 10000}
staticprivate

Definition at line 42 of file qgscomposerruler.h.

Referenced by optimumScale().

const int QgsComposerRuler::validScaleMultiples = {1, 2, 5}
staticprivate

Definition at line 41 of file qgscomposerruler.h.

Referenced by optimumScale().


The documentation for this class was generated from the following files: