QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
Public 类型 | Public 槽 | Public 成员函数 | Protected 成员函数 | 所有成员列表
QwtAnalogClock类 参考

An analog clock widget 更多...

#include <qwt_analog_clock.h>

类 QwtAnalogClock 继承关系图:
QwtDial QwtAbstractSlider QwtAbstractScale

Public 类型

enum  Hand { SecondHand , MinuteHand , HourHand , NHands }
 Hand type enumeration 更多...
 
- Public 类型 继承自 QwtDial
enum  Shadow { Plain = QFrame::Plain , Raised = QFrame::Raised , Sunken = QFrame::Sunken }
 Frame shadow 更多...
 
enum  Mode { RotateNeedle , RotateScale }
 Mode controlling whether the needle or the scale is rotating 更多...
 

Public 槽

void setCurrentTime ()
 Set the clock to display the current time
 
void setTime (const QTime &)
 Set the clock to display a specific time
 
- Public 槽 继承自 QwtAbstractSlider
void setValue (double value)
 Set the slider value (English only)
 

Public 成员函数

 QwtAnalogClock (QWidget *parent=nullptr)
 Constructor
 
 ~QwtAnalogClock () override
 Destructor
 
void setHand (Hand, QwtDialNeedle *)
 Set a clock hand
 
const QwtDialNeedlehand (Hand) const
 Get a clock hand (const version)
 
QwtDialNeedlehand (Hand)
 Get a clock hand
 
- Public 成员函数 继承自 QwtDial
 QwtDial (QWidget *parent=nullptr)
 Constructor
 
 ~QwtDial () override
 Destructor
 
void setFrameShadow (Shadow)
 Set the frame shadow
 
Shadow frameShadow () const
 Return the frame shadow
 
void setLineWidth (int)
 Set the line width
 
int lineWidth () const
 Return the line width
 
void setMode (Mode)
 Set the mode
 
Mode mode () const
 Return the mode
 
void setScaleArc (double minArc, double maxArc)
 Set the scale arc range
 
void setMinScaleArc (double)
 Set the minimum scale arc
 
double minScaleArc () const
 Return the minimum scale arc
 
void setMaxScaleArc (double)
 Set the maximum scale arc
 
double maxScaleArc () const
 Return the maximum scale arc
 
virtual void setOrigin (double)
 Set the origin
 
double origin () const
 Return the origin
 
void setNeedle (QwtDialNeedle *)
 Set the needle
 
const QwtDialNeedleneedle () const
 Return the needle (const version)
 
QwtDialNeedleneedle ()
 Return the needle
 
QRect boundingRect () const
 Return the bounding rectangle
 
QRect innerRect () const
 Return the inner rectangle
 
virtual QRect scaleInnerRect () const
 Return the scale inner rectangle
 
virtual QSize sizeHint () const override
 Return the size hint
 
virtual QSize minimumSizeHint () const override
 Return the minimum size hint
 
void setScaleDraw (QwtRoundScaleDraw *)
 Set the scale draw
 
QwtRoundScaleDrawscaleDraw ()
 Return the scale draw
 
const QwtRoundScaleDrawscaleDraw () const
 Return the scale draw (const version)
 
- Public 成员函数 继承自 QwtAbstractSlider
 QwtAbstractSlider (QWidget *parent=nullptr)
 Constructor for QwtAbstractSlider (English only)
 
 ~QwtAbstractSlider () override
 Destructor for QwtAbstractSlider (English only)
 
void setValid (bool)
 Set whether the slider is valid (English only)
 
bool isValid () const
 Return whether the slider is valid (English only)
 
double value () const
 Return the current value (English only)
 
void setWrapping (bool)
 Set whether wrapping is enabled (English only)
 
bool wrapping () const
 Return whether wrapping is enabled (English only)
 
void setTotalSteps (uint)
 Set the total number of steps (English only)
 
uint totalSteps () const
 Return the total number of steps (English only)
 
void setSingleSteps (uint)
 Set the number of single steps (English only)
 
uint singleSteps () const
 Return the number of single steps (English only)
 
void setPageSteps (uint)
 Set the number of page steps (English only)
 
uint pageSteps () const
 Return the number of page steps (English only)
 
void setStepAlignment (bool)
 Set whether step alignment is enabled (English only)
 
bool stepAlignment () const
 Return whether step alignment is enabled (English only)
 
void setTracking (bool)
 Set whether tracking is enabled (English only)
 
bool isTracking () const
 Return whether tracking is enabled (English only)
 
void setReadOnly (bool)
 Set whether the slider is read-only (English only)
 
bool isReadOnly () const
 Return whether the slider is read-only (English only)
 
void setInvertedControls (bool)
 Set whether controls are inverted (English only)
 
bool invertedControls () const
 Return whether controls are inverted (English only)
 
- Public 成员函数 继承自 QwtAbstractScale
 QwtAbstractScale (QWidget *parent=nullptr)
 Constructor for QwtAbstractScale
 
void setScale (double lowerBound, double upperBound)
 Specify a scale by interval bounds
 
void setScale (const QwtInterval &)
 Specify a scale by interval
 
void setScale (const QwtScaleDiv &)
 Specify a scale by scale division
 
const QwtScaleDivscaleDiv () const
 Return the scale division
 
void setLowerBound (double value)
 Set the lower bound of the scale
 
double lowerBound () const
 Return the lower bound of the scale
 
void setUpperBound (double value)
 Set the upper bound of the scale
 
double upperBound () const
 Return the upper bound of the scale
 
void setScaleStepSize (double stepSize)
 Set the step size used for calculating scale division
 
double scaleStepSize () const
 Return the step size hint
 
void setScaleMaxMajor (int ticks)
 Set the maximum number of major tick intervals
 
int scaleMaxMinor () const
 Return the maximum number of minor tick intervals
 
void setScaleMaxMinor (int ticks)
 Set the maximum number of minor tick intervals
 
int scaleMaxMajor () const
 Return the maximum number of major tick intervals
 
void setScaleEngine (QwtScaleEngine *)
 Set the scale engine
 
const QwtScaleEnginescaleEngine () const
 Return the scale engine (const version)
 
QwtScaleEnginescaleEngine ()
 Return the scale engine (non-const version)
 
int transform (double) const
 Transform a scale value to widget coordinates
 
double invTransform (int) const
 Transform a widget coordinate to scale value
 
bool isInverted () const
 Check if scale is inverted
 
double minimum () const
 Return the minimum boundary
 
double maximum () const
 Return the maximum boundary
 
const QwtScaleMapscaleMap () const
 Return the scale map
 

Protected 成员函数

virtual void drawNeedle (QPainter *, const QPointF &, double radius, double direction, QPalette::ColorGroup) const override
 Draw the needle
 
virtual void drawHand (QPainter *, Hand, const QPointF &, double radius, double direction, QPalette::ColorGroup) const
 Draw a clock hand
 
- Protected 成员函数 继承自 QwtDial
virtual void wheelEvent (QWheelEvent *) override
 Wheel Event handler
 
virtual void paintEvent (QPaintEvent *) override
 Paint the dial
 
virtual void changeEvent (QEvent *) override
 Change Event handler
 
virtual void drawFrame (QPainter *)
 Draw the frame around the dial
 
virtual void drawContents (QPainter *) const
 Draw the contents inside the frame
 
virtual void drawFocusIndicator (QPainter *) const
 Draw the focus indicator
 
void invalidateCache ()
 Invalidate the internal caches used to speed up repainting
 
virtual void drawScale (QPainter *, const QPointF &center, double radius) const
 Draw the scale
 
virtual void drawScaleContents (QPainter *painter, const QPointF &center, double radius) const
 Draw the contents inside the scale
 
virtual double scrolledTo (const QPoint &) const override
 Determine the value for a new position of the slider handle.
 
virtual bool isScrollPosition (const QPoint &) const override
 Determine what to do when the user presses a mouse button.
 
virtual void sliderChange () override
 Handle slider changes (English only)
 
virtual void scaleChange () override
 Invalidate the internal caches and call QwtAbstractSlider::scaleChange()
 
- Protected 成员函数 继承自 QwtAbstractSlider
virtual void mousePressEvent (QMouseEvent *) override
 Handle mouse press events (English only)
 
virtual void mouseReleaseEvent (QMouseEvent *) override
 Handle mouse release events (English only)
 
virtual void mouseMoveEvent (QMouseEvent *) override
 Handle mouse move events (English only)
 
virtual void keyPressEvent (QKeyEvent *) override
 Handle key press events (English only)
 
void incrementValue (int stepCount)
 Increment the value by a number of steps (English only)
 
double incrementedValue (double value, int stepCount) const
 Calculate incremented value (English only)
 
- Protected 成员函数 继承自 QwtAbstractScale
void rescale (double lowerBound, double upperBound, double stepSize)
 Recalculate scale and update scale draw (English only)
 
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
 Set the scale draw object (English only)
 
const QwtAbstractScaleDrawabstractScaleDraw () const
 Return the scale draw (const version) (English only)
 
QwtAbstractScaleDrawabstractScaleDraw ()
 Return the scale draw (non-const version) (English only)
 
void updateScaleDraw ()
 Update the scale draw (English only)
 

额外继承的成员函数

- 信号 继承自 QwtAbstractSlider
void valueChanged (double value)
 Notify a change of value
 
void sliderPressed ()
 Signal emitted when the user presses the movable part of the slider
 
void sliderReleased ()
 Signal emitted when the user releases the movable part of the slider
 
void sliderMoved (double value)
 Signal emitted when the user moves the slider with the mouse
 
- 属性 继承自 QwtDial
int lineWidth
 
Shadow frameShadow
 
Mode mode
 
double origin
 
double minScaleArc
 
double maxScaleArc
 
- 属性 继承自 QwtAbstractSlider
double value
 
uint totalSteps
 
uint singleSteps
 
uint pageSteps
 
bool stepAlignment
 
bool readOnly
 
bool tracking
 
bool wrapping
 
bool invertedControls
 
- 属性 继承自 QwtAbstractScale
double lowerBound
 
double upperBound
 
int scaleMaxMajor
 
int scaleMaxMinor
 
double scaleStepSize
 

详细描述

An analog clock widget

QwtAnalogClock is a widget that displays an analog clock with hour, minute, and second hands.

Example
#include <qwt_analog_clock.h>
QwtAnalogClock *clock = new QwtAnalogClock(...);
clock->scaleDraw()->setPenWidth(3);
clock->setLineWidth(6);
clock->setTime();
// update the clock every second
QTimer *timer = new QTimer(clock);
timer->connect(timer, SIGNAL(timeout()), clock, SLOT(setCurrentTime()));
timer->start(1000);
An analog clock widget
Definition qwt_analog_clock.h:57
void setCurrentTime()
Set the clock to display the current time
Definition qwt_analog_clock.cpp:183
void setTime(const QTime &)
Set the clock to display a specific time
Definition qwt_analog_clock.cpp:194
void setFrameShadow(Shadow)
Set the frame shadow
Definition qwt_dial.cpp:170
@ Sunken
QFrame::Sunken
Definition qwt_dial.h:91
void setLineWidth(int)
Set the line width
Definition qwt_dial.cpp:197
QwtRoundScaleDraw * scaleDraw()
Return the scale draw
Definition qwt_dial.cpp:543
注解
The examples/dials example shows how to use QwtAnalogClock.

成员枚举类型说明

◆ Hand

Hand type enumeration

Defines the types of clock hands available.

参见
setHand(), hand()
枚举值
SecondHand 

Needle displaying the seconds

MinuteHand 

Needle displaying the minutes

HourHand 

Needle displaying the hours

NHands 

Number of needles

构造及析构函数说明

◆ QwtAnalogClock()

QwtAnalogClock::QwtAnalogClock ( QWidget *  parent = nullptr)
explicit

Constructor

参数
[in]parentParent widget

Creates an analog clock widget with default appearance. The clock is read-only and displays the current time.

成员函数说明

◆ drawHand()

void QwtAnalogClock::drawHand ( QPainter *  painter,
Hand  hd,
const QPointF &  center,
double  radius,
double  direction,
QPalette::ColorGroup  cg 
) const
protectedvirtual

Draw a clock hand

参数
painterPainter
hdSpecify the type of hand
centerCenter of the clock
radiusMaximum length for the hands
directionDirection of the hand in degrees, counter clockwise
cgColorGroup

◆ drawNeedle()

void QwtAnalogClock::drawNeedle ( QPainter *  painter,
const QPointF &  center,
double  radius,
double  direction,
QPalette::ColorGroup  colorGroup 
) const
overrideprotectedvirtual

Draw the needle

A clock has no single needle but three hands instead. drawNeedle() translates value() into directions for the hands and calls drawHand().

参数
painterPainter
centerCenter of the clock
radiusMaximum length for the hands
directionDummy, not used.
colorGroupColorGroup
参见
drawHand()

重载 QwtDial .

◆ hand() [1/2]

QwtDialNeedle * QwtAnalogClock::hand ( Hand  hd)

Get a clock hand

参数
[in]hdSpecifies the type of hand
返回
Clock hand needle, or nullptr if invalid hand type
参见
setHand()

◆ hand() [2/2]

const QwtDialNeedle * QwtAnalogClock::hand ( Hand  hd) const

Get a clock hand (const version)

参数
[in]hdSpecifies the type of hand
返回
Clock hand needle (const), or nullptr if invalid hand type
参见
setHand()

◆ setCurrentTime

void QwtAnalogClock::setCurrentTime ( )
slot

Set the clock to display the current time

Updates the clock display to show the current system time.

Updates the clock to show the current system time.

◆ setHand()

void QwtAnalogClock::setHand ( Hand  hand,
QwtDialNeedle needle 
)

Set a clock hand

参数
[in]handSpecifies the type of hand (SecondHand, MinuteHand, HourHand)
[in]needleNeedle object representing the hand
参见
hand()

◆ setTime

void QwtAnalogClock::setTime ( const QTime &  time)
slot

Set the clock to display a specific time

参数
[in]timeTime to display
[in]timeTime to display

Sets the clock to display the given time. If the time is invalid, the clock display is invalidated.


该类的文档由以下文件生成: