qwt_knob.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_KNOB_H
#define QWT_KNOB_H
#include "qwt_global.h"
#include "qwt_abstract_slider.h"
class QwtRoundScaleDraw;
class QWT_EXPORT QwtKnob: public QwtAbstractSlider
{
Q_OBJECT
Q_ENUMS ( KnobStyle MarkerStyle )
Q_PROPERTY( KnobStyle knobStyle READ knobStyle WRITE setKnobStyle )
Q_PROPERTY( int knobWidth READ knobWidth WRITE setKnobWidth )
Q_PROPERTY( Qt::Alignment alignment READ alignment WRITE setAlignment )
Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle )
Q_PROPERTY( int numTurns READ numTurns WRITE setNumTurns )
Q_PROPERTY( MarkerStyle markerStyle READ markerStyle WRITE setMarkerStyle )
Q_PROPERTY( int markerSize READ markerSize WRITE setMarkerSize )
Q_PROPERTY( int borderWidth READ borderWidth WRITE setBorderWidth )
public:
enum KnobStyle
{
Flat,
Raised,
Sunken,
Styled
};
enum MarkerStyle
{
NoMarker = -1,
Tick,
Triangle,
Dot,
Nub,
Notch
};
explicit QwtKnob( QWidget* parent = NULL );
virtual ~QwtKnob();
void setAlignment( Qt::Alignment );
Qt::Alignment alignment() const;
void setKnobWidth( int );
int knobWidth() const;
void setNumTurns( int );
int numTurns() const;
void setTotalAngle ( double angle );
double totalAngle() const;
void setKnobStyle( KnobStyle );
KnobStyle knobStyle() const;
void setBorderWidth( int );
int borderWidth() const;
void setMarkerStyle( MarkerStyle );
MarkerStyle markerStyle() const;
void setMarkerSize( int );
int markerSize() const;
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
void setScaleDraw( QwtRoundScaleDraw * );
const QwtRoundScaleDraw *scaleDraw() const;
QwtRoundScaleDraw *scaleDraw();
QRect knobRect() const;
protected:
virtual void paintEvent( QPaintEvent * );
virtual void changeEvent( QEvent * );
virtual void drawKnob( QPainter *, const QRectF & ) const;
virtual void drawFocusIndicator( QPainter * ) const;
virtual void drawMarker( QPainter *,
const QRectF &, double angle ) const;
virtual double scrolledTo( const QPoint & ) const;
virtual bool isScrollPosition( const QPoint & ) const;
private:
class PrivateData;
PrivateData *d_data;
};
#endif
QwtKnob::Dot
@ Dot
Paint a circle in QPalette::ButtonText color.
Definition: qwt_knob.h:107
QwtKnob::Raised
@ Raised
Build a gradient from QPalette::Midlight and QPalette::Button.
Definition: qwt_knob.h:72
QwtKnob::MarkerStyle
MarkerStyle
Marker type.
Definition: qwt_knob.h:96
QwtAbstractSlider::isScrollPosition
virtual bool isScrollPosition(const QPoint &pos) const =0
Determine what to do when the user presses a mouse button.
QwtAbstractSlider
An abstract base class for slider widgets with a scale.
Definition: qwt_abstract_slider.h:33
QwtKnob::Sunken
@ Sunken
Definition: qwt_knob.h:78
QwtKnob::Nub
@ Nub
Definition: qwt_knob.h:113
QwtKnob::Triangle
@ Triangle
Paint a triangle in QPalette::ButtonText color.
Definition: qwt_knob.h:104
QwtKnob::KnobStyle
KnobStyle
Style of the knob surface.
Definition: qwt_knob.h:67
QwtAbstractSlider::scrolledTo
virtual double scrolledTo(const QPoint &pos) const =0
Determine the value for a new position of the movable part of the slider.
QwtKnob::Flat
@ Flat
Fill the knob with a brush from QPalette::Button.
Definition: qwt_knob.h:69
QwtKnob
The Knob Widget.
Definition: qwt_knob.h:43
QwtRoundScaleDraw
A class for drawing round scales.
Definition: qwt_round_scale_draw.h:31
QwtKnob::Tick
@ Tick
Paint a single tick in QPalette::ButtonText color.
Definition: qwt_knob.h:101