Qwt User's Guide  6.2.0
QwtCompass Class Reference

A Compass Widget. More...

#include <qwt_compass.h>

Inheritance diagram for QwtCompass:

Public Member Functions

 QwtCompass (QWidget *parent=NULL)
 Constructor. More...
 
virtual ~QwtCompass ()
 Destructor.
 
void setRose (QwtCompassRose *rose)
 
const QwtCompassRoserose () const
 
QwtCompassRoserose ()
 
- Public Member Functions inherited from QwtDial
 QwtDial (QWidget *parent=NULL)
 Constructor. More...
 
virtual ~QwtDial ()
 Destructor.
 
void setFrameShadow (Shadow)
 
Shadow frameShadow () const
 
void setLineWidth (int)
 
int lineWidth () const
 
void setMode (Mode)
 Change the mode of the dial. More...
 
Mode mode () const
 
void setScaleArc (double minArc, double maxArc)
 
void setMinScaleArc (double)
 
double minScaleArc () const
 
void setMaxScaleArc (double)
 
double maxScaleArc () const
 
virtual void setOrigin (double)
 Change the origin. More...
 
double origin () const
 
void setNeedle (QwtDialNeedle *)
 
const QwtDialNeedleneedle () const
 
QwtDialNeedleneedle ()
 
QRect boundingRect () const
 
QRect innerRect () const
 
virtual QRect scaleInnerRect () const
 
virtual QSize sizeHint () const override
 
virtual QSize minimumSizeHint () const override
 
void setScaleDraw (QwtRoundScaleDraw *)
 
QwtRoundScaleDrawscaleDraw ()
 
const QwtRoundScaleDrawscaleDraw () const
 
- Public Member Functions inherited from QwtAbstractSlider
 QwtAbstractSlider (QWidget *parent=NULL)
 Constructor. More...
 
virtual ~QwtAbstractSlider ()
 Destructor.
 
void setValid (bool)
 
bool isValid () const
 
double value () const
 Returns the current value.
 
void setWrapping (bool)
 
bool wrapping () const
 
void setTotalSteps (uint)
 Set the number of steps. More...
 
uint totalSteps () const
 
void setSingleSteps (uint)
 Set the number of steps for a single increment. More...
 
uint singleSteps () const
 
void setPageSteps (uint)
 Set the number of steps for a page increment. More...
 
uint pageSteps () const
 
void setStepAlignment (bool)
 Enable step alignment. More...
 
bool stepAlignment () const
 
void setTracking (bool)
 Enables or disables tracking. More...
 
bool isTracking () const
 
void setReadOnly (bool)
 
bool isReadOnly () const
 
void setInvertedControls (bool)
 
bool invertedControls () const
 
- Public Member Functions inherited from QwtAbstractScale
 QwtAbstractScale (QWidget *parent=NULL)
 
virtual ~QwtAbstractScale ()
 Destructor.
 
void setScale (double lowerBound, double upperBound)
 Specify a scale. More...
 
void setScale (const QwtInterval &)
 Specify a scale. More...
 
void setScale (const QwtScaleDiv &)
 Specify a scale. More...
 
const QwtScaleDivscaleDiv () const
 
void setLowerBound (double value)
 
double lowerBound () const
 
void setUpperBound (double value)
 
double upperBound () const
 
void setScaleStepSize (double stepSize)
 Set the step size used for calculating a scale division. More...
 
double scaleStepSize () const
 
void setScaleMaxMajor (int ticks)
 Set the maximum number of major tick intervals. More...
 
int scaleMaxMinor () const
 
void setScaleMaxMinor (int ticks)
 Set the maximum number of minor tick intervals. More...
 
int scaleMaxMajor () const
 
void setScaleEngine (QwtScaleEngine *)
 Set a scale engine. More...
 
const QwtScaleEnginescaleEngine () const
 
QwtScaleEnginescaleEngine ()
 
int transform (double) const
 
double invTransform (int) const
 
bool isInverted () const
 
double minimum () const
 
double maximum () const
 
const QwtScaleMapscaleMap () const
 

Protected Member Functions

virtual void drawRose (QPainter *, const QPointF &center, double radius, double north, QPalette::ColorGroup) const
 
virtual void drawScaleContents (QPainter *, const QPointF &center, double radius) const override
 
virtual void keyPressEvent (QKeyEvent *) override
 
- Protected Member Functions inherited from QwtDial
virtual void wheelEvent (QWheelEvent *) override
 
virtual void paintEvent (QPaintEvent *) override
 
virtual void changeEvent (QEvent *) override
 
virtual void drawFrame (QPainter *)
 
virtual void drawContents (QPainter *) const
 Draw the contents inside the frame. More...
 
virtual void drawFocusIndicator (QPainter *) const
 
void invalidateCache ()
 
virtual void drawScale (QPainter *, const QPointF &center, double radius) const
 
virtual void drawNeedle (QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const
 
virtual double scrolledTo (const QPoint &) const override
 Determine the value for a new position of the slider handle. More...
 
virtual bool isScrollPosition (const QPoint &) const override
 Determine what to do when the user presses a mouse button. More...
 
virtual void sliderChange () override
 Calling update()
 
virtual void scaleChange () override
 
- Protected Member Functions inherited from QwtAbstractSlider
virtual void mousePressEvent (QMouseEvent *) override
 
virtual void mouseReleaseEvent (QMouseEvent *) override
 
virtual void mouseMoveEvent (QMouseEvent *) override
 
void incrementValue (int stepCount)
 
double incrementedValue (double value, int stepCount) const
 
- Protected Member Functions inherited from QwtAbstractScale
void rescale (double lowerBound, double upperBound, double stepSize)
 
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
 Set a scale draw. More...
 
const QwtAbstractScaleDrawabstractScaleDraw () const
 
QwtAbstractScaleDrawabstractScaleDraw ()
 
void updateScaleDraw ()
 

Additional Inherited Members

- Public Types inherited from QwtDial
enum  Shadow { Plain = QFrame::Plain , Raised = QFrame::Raised , Sunken = QFrame::Sunken }
 Frame shadow. More...
 
enum  Mode { RotateNeedle , RotateScale }
 Mode controlling whether the needle or the scale is rotating. More...
 
- Public Slots inherited from QwtAbstractSlider
void setValue (double value)
 
- Signals inherited from QwtAbstractSlider
void valueChanged (double value)
 Notify a change of value. More...
 
void sliderPressed ()
 
void sliderReleased ()
 
void sliderMoved (double value)
 

Detailed Description

A Compass Widget.

QwtCompass is a widget to display and enter directions. It consists of a scale, an optional needle and rose.

Note
The examples/dials example shows how to use QwtCompass.

Definition at line 61 of file qwt_compass.h.

Constructor & Destructor Documentation

◆ QwtCompass()

QwtCompass::QwtCompass ( QWidget *  parent = NULL)
explicit

Constructor.

Parameters
parentParent widget

Create a compass widget with a scale, no needle and no rose. The default origin is 270.0 with no valid value. It accepts mouse and keyboard inputs and has no step size. The default mode is QwtDial::RotateNeedle.

Definition at line 158 of file qwt_compass.cpp.

Member Function Documentation

◆ drawRose()

void QwtCompass::drawRose ( QPainter *  painter,
const QPointF &  center,
double  radius,
double  north,
QPalette::ColorGroup  cg 
) const
protectedvirtual

Draw the compass rose

Parameters
painterPainter
centerCenter of the compass
radiusof the circle, where to paint the rose
northDirection pointing north, in degrees counter clockwise
cgColor group

Definition at line 218 of file qwt_compass.cpp.

◆ drawScaleContents()

void QwtCompass::drawScaleContents ( QPainter *  painter,
const QPointF &  center,
double  radius 
) const
overrideprotectedvirtual

Draw the contents of the scale

Parameters
painterPainter
centerCenter of the content circle
radiusRadius of the content circle

Reimplemented from QwtDial.

Definition at line 189 of file qwt_compass.cpp.

◆ keyPressEvent()

void QwtCompass::keyPressEvent ( QKeyEvent *  kev)
overrideprotectedvirtual

Handles key events

Beside the keys described in QwtDial::keyPressEvent numbers from 1-9 (without 5) set the direction according to their position on the num pad.

See also
isReadOnly()

Reimplemented from QwtAbstractSlider.

Definition at line 271 of file qwt_compass.cpp.

◆ rose() [1/2]

QwtCompassRose * QwtCompass::rose ( )
Returns
rose
See also
setRose()

Definition at line 257 of file qwt_compass.cpp.

◆ rose() [2/2]

const QwtCompassRose * QwtCompass::rose ( ) const
Returns
rose
See also
setRose()

Definition at line 248 of file qwt_compass.cpp.

◆ setRose()

void QwtCompass::setRose ( QwtCompassRose rose)

Set a rose for the compass

Parameters
roseCompass rose
Warning
The rose will be deleted, when a different rose is set or in ~QwtCompass
See also
rose()

Definition at line 232 of file qwt_compass.cpp.