1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the Qwt License, Version 1.0
8
*****************************************************************************/
12
#if QT_VERSION >= 0x040000
13
#include <qpaintengine.h>
20
#include "qwt_scale_engine.h"
21
#include "qwt_scale_map.h"
22
#include "qwt_paint_buffer.h"
23
#include "qwt_painter.h"
24
#include "qwt_dial_needle.h"
27
#if QT_VERSION >= 0x040000
28
static void setAntialiasing(QPainter *painter, bool on)
30
QPaintEngine *engine = painter->paintEngine();
31
if ( engine && engine->hasFeature(QPaintEngine::Antialiasing) )
32
painter->setRenderHint(QPainter::Antialiasing, on);
35
static void setAntialiasing(QPainter *, bool)
40
class QwtDial::PrivateData
44
visibleBackground(true),
64
bool visibleBackground;
74
QwtDialScaleDraw *scaleDraw;
79
QwtDialNeedle *needle;
81
static double previousDir;
84
double QwtDial::PrivateData::previousDir = -1.0;
89
\param parent Parent dial widget
91
QwtDialScaleDraw::QwtDialScaleDraw(QwtDial *parent):
98
Set the pen width used for painting the scale
100
\param penWidth Pen width
101
\sa penWidth(), QwtDial::drawScale()
104
void QwtDialScaleDraw::setPenWidth(uint penWidth)
106
d_penWidth = penWidth;
110
\return Pen width used for painting the scale
111
\sa setPenWidth, QwtDial::drawScale()
113
uint QwtDialScaleDraw::penWidth() const
119
Call QwtDial::scaleLabel of the parent dial widget.
121
\param value Value to display
123
\sa QwtDial::scaleLabel
125
QwtText QwtDialScaleDraw::label(double value) const
127
if ( d_parent == NULL )
128
return QwtRoundScaleDraw::label(value);
130
return d_parent->scaleLabel(value);
135
\param parent Parent widget
137
Create a dial widget with no scale and no needle.
138
The default origin is 90.0 with no valid value. It accepts
139
mouse and keyboard inputs and has no step size. The default mode
140
is QwtDial::RotateNeedle.
143
QwtDial::QwtDial(QWidget* parent):
144
QwtAbstractSlider(Qt::Horizontal, parent)
149
#if QT_VERSION < 0x040000
152
\param parent Parent widget
153
\param name Object name
155
Create a dial widget with no scale and no needle.
156
The default origin is 90.0 with no valid value. It accepts
157
mouse and keyboard inputs and has no step size. The default mode
158
is QwtDial::RotateNeedle.
160
QwtDial::QwtDial(QWidget* parent, const char *name):
161
QwtAbstractSlider(Qt::Horizontal, parent)
168
void QwtDial::initDial()
170
d_data = new PrivateData;
172
#if QT_VERSION < 0x040000
173
setWFlags(Qt::WNoAutoErase);
176
#if QT_VERSION >= 0x040000
179
setFocusPolicy(TabFocus);
181
QPalette p = palette();
182
for ( int i = 0; i < QPalette::NColorGroups; i++ )
184
const QPalette::ColorGroup cg = (QPalette::ColorGroup)i;
186
// Base: background color of the circle inside the frame.
187
// Foreground: background color of the circle inside the scale
189
#if QT_VERSION < 0x040000
190
p.setColor(cg, QColorGroup::Foreground,
191
p.color(cg, QColorGroup::Base));
193
p.setColor(cg, QPalette::Foreground,
194
p.color(cg, QPalette::Base));
199
d_data->scaleDraw = new QwtDialScaleDraw(this);
200
d_data->scaleDraw->setRadius(0);
202
setScaleArc(0.0, 360.0); // scale as a full circle
203
setRange(0.0, 360.0, 1.0, 10); // degrees as deafult
213
Show/Hide the area outside of the frame
214
\param show Show if true, hide if false
216
\sa hasVisibleBackground(), setMask()
217
\warning When QwtDial is a toplevel widget the window
218
border might disappear too.
220
void QwtDial::showBackground(bool show)
222
if ( d_data->visibleBackground != show )
224
d_data->visibleBackground = show;
230
true when the area outside of the frame is visible
232
\sa showBackground(), setMask()
234
bool QwtDial::hasVisibleBackground() const
236
return d_data->visibleBackground;
240
Sets the frame shadow value from the frame style.
241
\param shadow Frame shadow
242
\sa setLineWidth(), QFrame::setFrameShadow()
244
void QwtDial::setFrameShadow(Shadow shadow)
246
if ( shadow != d_data->frameShadow )
248
d_data->frameShadow = shadow;
249
if ( lineWidth() > 0 )
256
/sa setFrameShadow(), lineWidth(), QFrame::frameShadow
258
QwtDial::Shadow QwtDial::frameShadow() const
260
return d_data->frameShadow;
266
\param lineWidth Line width
269
void QwtDial::setLineWidth(int lineWidth)
274
if ( d_data->lineWidth != lineWidth )
276
d_data->lineWidth = lineWidth;
282
\return Line width of the frame
283
\sa setLineWidth(), frameShadow(), lineWidth()
285
int QwtDial::lineWidth() const
287
return d_data->lineWidth;
291
\return bounding rect of the circle inside the frame
292
\sa setLineWidth(), scaleContentsRect(), boundingRect()
294
QRect QwtDial::contentsRect() const
296
const int lw = lineWidth();
298
QRect r = boundingRect();
301
r.setRect(r.x() + lw, r.y() + lw,
302
r.width() - 2 * lw, r.height() - 2 * lw);
308
\return bounding rect of the dial including the frame
309
\sa setLineWidth(), scaleContentsRect(), contentsRect()
311
QRect QwtDial::boundingRect() const
313
const int radius = qwtMin(width(), height()) / 2;
315
QRect r(0, 0, 2 * radius, 2 * radius);
316
r.moveCenter(rect().center());
321
\return rect inside the scale
322
\sa setLineWidth(), boundingRect(), contentsRect()
324
QRect QwtDial::scaleContentsRect() const
326
#if QT_VERSION < 0x040000
327
const QPen scalePen(colorGroup().text(), 0, Qt::NoPen);
329
const QPen scalePen(palette().text(), 0, Qt::NoPen);
333
if ( d_data->scaleDraw )
335
scaleDist = d_data->scaleDraw->extent(scalePen, font());
336
scaleDist++; // margin
339
const QRect rect = contentsRect();
340
return QRect(rect.x() + scaleDist, rect.y() + scaleDist,
341
rect.width() - 2 * scaleDist, rect.height() - 2 * scaleDist);
345
\brief Change the mode of the meter.
348
The value of the meter is indicated by the difference
349
between north of the scale and the direction of the needle.
350
In case of QwtDial::RotateNeedle north is pointing
351
to the origin() and the needle is rotating, in case of
352
QwtDial::RotateScale, the needle points to origin()
353
and the scale is rotating.
355
The default mode is QwtDial::RotateNeedle.
357
\sa mode(), setValue(), setOrigin()
359
void QwtDial::setMode(Mode mode)
361
if ( mode != d_data->mode )
369
\return mode of the dial.
371
The value of the dial is indicated by the difference
372
between the origin and the direction of the needle.
373
In case of QwtDial::RotateNeedle the scale arc is fixed
374
to the origin() and the needle is rotating, in case of
375
QwtDial::RotateScale, the needle points to origin()
376
and the scale is rotating.
378
The default mode is QwtDial::RotateNeedle.
380
\sa setMode(), origin(), setScaleArc(), value()
382
QwtDial::Mode QwtDial::mode() const
388
Sets whether it is possible to step the value from the highest value to
389
the lowest value and vice versa to on.
391
\param wrapping en/disables wrapping
393
\sa wrapping(), QwtDoubleRange::periodic()
394
\note The meaning of wrapping is like the wrapping property of QSpinBox,
395
but not like it is used in QDial.
397
void QwtDial::setWrapping(bool wrapping)
399
setPeriodic(wrapping);
403
wrapping() holds whether it is possible to step the value from the
404
highest value to the lowest value and vice versa.
406
\sa setWrapping(), QwtDoubleRange::setPeriodic()
407
\note The meaning of wrapping is like the wrapping property of QSpinBox,
408
but not like it is used in QDial.
410
bool QwtDial::wrapping() const
416
Resize the dial widget
417
\param e Resize event
419
void QwtDial::resizeEvent(QResizeEvent *e)
421
QWidget::resizeEvent(e);
423
if ( !hasVisibleBackground() )
431
void QwtDial::paintEvent(QPaintEvent *e)
433
const QRect &ur = e->rect();
436
#if QT_VERSION < 0x040000
437
QwtPaintBuffer paintBuffer(this, ur);
438
QPainter &painter = *paintBuffer.painter();
440
QPainter painter(this);
443
setAntialiasing(&painter, true);
446
drawContents(&painter);
454
drawFocusIndicator(&painter);
459
Draw a dotted round circle, if !isReadOnly()
461
\param painter Painter
463
void QwtDial::drawFocusIndicator(QPainter *painter) const
467
QRect focusRect = contentsRect();
469
const int margin = 2;
471
focusRect.x() + margin,
472
focusRect.y() + margin,
473
focusRect.width() - 2 * margin,
474
focusRect.height() - 2 * margin);
476
#if QT_VERSION < 0x040000
477
QColor color = colorGroup().color(QColorGroup::Base);
479
QColor color = palette().color(QPalette::Base);
483
const QColor gray(Qt::gray);
486
#if QT_VERSION < 0x040000
487
color.hsv(&h, &s, &v);
489
color.getHsv(&h, &s, &v);
491
color = (v > 128) ? gray.dark(120) : gray.light(120);
494
color = Qt::darkGray;
497
painter->setBrush(Qt::NoBrush);
498
painter->setPen(QPen(color, 0, Qt::DotLine));
499
painter->drawEllipse(focusRect);
505
Draw the frame around the dial
507
\param painter Painter
508
\sa lineWidth(), frameShadow()
510
void QwtDial::drawFrame(QPainter *painter)
512
const int lw = lineWidth();
513
const int off = (lw + 1) % 2;
515
QRect r = boundingRect();
516
r.setRect(r.x() + lw / 2 - off, r.y() + lw / 2 - off,
517
r.width() - lw + off + 1, r.height() - lw + off + 1);
518
#if QT_VERSION >= 0x040000
523
r.setWidth(r.width() - 2);
524
r.setHeight(r.height() - 2);
529
switch(d_data->frameShadow)
531
case QwtDial::Raised:
532
#if QT_VERSION < 0x040000
533
QwtPainter::drawRoundFrame(painter, r,
534
lw, colorGroup(), false);
536
QwtPainter::drawRoundFrame(painter, r,
537
lw, palette(), false);
540
case QwtDial::Sunken:
541
#if QT_VERSION < 0x040000
542
QwtPainter::drawRoundFrame(painter, r,
543
lw, colorGroup(), true);
545
QwtPainter::drawRoundFrame(painter, r,
546
lw, palette(), true);
552
painter->setPen(QPen(Qt::black, lw));
553
painter->setBrush(Qt::NoBrush);
554
painter->drawEllipse(r);
562
\brief Draw the contents inside the frame
564
QColorGroup::Background is the background color outside of the frame.
565
QColorGroup::Base is the background color inside the frame.
566
QColorGroup::Foreground is the background color inside the scale.
568
\param painter Painter
569
\sa boundingRect(), contentsRect(),
570
scaleContentsRect(), QWidget::setPalette
572
void QwtDial::drawContents(QPainter *painter) const
574
#if QT_VERSION < 0x040000
575
if ( backgroundMode() == Qt::NoBackground ||
576
colorGroup().brush(QColorGroup::Base) !=
577
colorGroup().brush(QColorGroup::Background) )
579
if ( testAttribute(Qt::WA_NoSystemBackground) ||
580
palette().brush(QPalette::Base) !=
581
palette().brush(QPalette::Background) )
585
const QRect br = boundingRect();
588
painter->setPen(Qt::NoPen);
590
#if QT_VERSION < 0x040000
591
painter->setBrush(colorGroup().brush(QColorGroup::Base));
593
painter->setBrush(palette().brush(QPalette::Base));
596
painter->drawEllipse(br);
601
const QRect insideScaleRect = scaleContentsRect();
602
#if QT_VERSION < 0x040000
603
if ( colorGroup().brush(QColorGroup::Foreground) !=
604
colorGroup().brush(QColorGroup::Base) )
606
if ( palette().brush(QPalette::Foreground) !=
607
palette().brush(QPalette::Base) )
611
painter->setPen(Qt::NoPen);
613
#if QT_VERSION < 0x040000
614
painter->setBrush(colorGroup().brush(QColorGroup::Foreground));
616
painter->setBrush(palette().brush(QPalette::Foreground));
619
painter->drawEllipse(insideScaleRect.x() - 1, insideScaleRect.y() - 1,
620
insideScaleRect.width(), insideScaleRect.height() );
625
const QPoint center = insideScaleRect.center();
626
const int radius = insideScaleRect.width() / 2;
629
drawScaleContents(painter, center, radius);
632
double direction = d_data->origin;
636
direction = d_data->origin + d_data->minScaleArc;
637
if ( maxValue() > minValue() && d_data->maxScaleArc > d_data->minScaleArc )
640
(value() - minValue()) / (maxValue() - minValue());
641
direction += ratio * (d_data->maxScaleArc - d_data->minScaleArc);
644
if ( direction >= 360.0 )
648
double origin = d_data->origin;
649
if ( mode() == RotateScale )
651
origin -= direction - d_data->origin;
652
direction = d_data->origin;
656
drawScale(painter, center, radius, origin, d_data->minScaleArc, d_data->maxScaleArc);
661
QPalette::ColorGroup cg;
663
cg = hasFocus() ? QPalette::Active : QPalette::Inactive;
665
cg = QPalette::Disabled;
668
drawNeedle(painter, center, radius, direction, cg);
676
\param painter Painter
677
\param center Center of the dial
678
\param radius Length for the needle
679
\param direction Direction of the needle in degrees, counter clockwise
682
void QwtDial::drawNeedle(QPainter *painter, const QPoint ¢er,
683
int radius, double direction, QPalette::ColorGroup cg) const
685
if ( d_data->needle )
687
direction = 360.0 - direction; // counter clockwise
688
d_data->needle->draw(painter, center, radius, direction, cg);
695
\param painter Painter
696
\param center Center of the dial
697
\param radius Radius of the scale
698
\param origin Origin of the scale
699
\param minArc Minimum of the arc
700
\param maxArc Minimum of the arc
702
\sa QwtAbstractScaleDraw::setAngleRange
704
void QwtDial::drawScale(QPainter *painter, const QPoint ¢er,
705
int radius, double origin, double minArc, double maxArc) const
707
if ( d_data->scaleDraw == NULL )
710
origin -= 270.0; // hardcoded origin of QwtScaleDraw
712
double angle = maxArc - minArc;
714
angle = fmod(angle, 360.0);
717
if ( minArc < -360.0 )
718
minArc = fmod(minArc, 360.0);
720
maxArc = minArc + angle;
721
if ( maxArc > 360.0 )
723
// QwtAbstractScaleDraw::setAngleRange accepts only values
724
// in the range [-360.0..360.0]
729
painter->setFont(font());
731
d_data->scaleDraw->setAngleRange(minArc, maxArc);
732
d_data->scaleDraw->setRadius(radius);
733
d_data->scaleDraw->moveCenter(center);
735
#if QT_VERSION < 0x040000
736
QColorGroup cg = colorGroup();
738
const QColor textColor = cg.color(QColorGroup::Text);
739
cg.setColor(QColorGroup::Foreground, textColor);
740
painter->setPen(QPen(textColor, d_data->scaleDraw->penWidth()));
742
d_data->scaleDraw->draw(painter, cg);
744
QPalette pal = palette();
746
const QColor textColor = pal.color(QPalette::Text);
747
pal.setColor(QPalette::Foreground, textColor); //ticks, backbone
749
painter->setPen(QPen(textColor, d_data->scaleDraw->penWidth()));
751
d_data->scaleDraw->draw(painter, pal);
755
void QwtDial::drawScaleContents(QPainter *,
756
const QPoint &, int) const
758
// empty default implementation
762
Set a needle for the dial
764
Qwt is missing a set of good looking needles.
765
Contributions are very welcome.
768
\warning The needle will be deleted, when a different needle is
771
void QwtDial::setNeedle(QwtDialNeedle *needle)
773
if ( needle != d_data->needle )
775
if ( d_data->needle )
776
delete d_data->needle;
778
d_data->needle = needle;
787
const QwtDialNeedle *QwtDial::needle() const
789
return d_data->needle;
796
QwtDialNeedle *QwtDial::needle()
798
return d_data->needle;
801
//! QwtDoubleRange update hook
802
void QwtDial::rangeChange()
808
Update the scale with the current attributes
811
void QwtDial::updateScale()
813
if ( d_data->scaleDraw )
815
QwtLinearScaleEngine scaleEngine;
817
const QwtScaleDiv scaleDiv = scaleEngine.divideScale(
818
minValue(), maxValue(),
819
d_data->maxMajIntv, d_data->maxMinIntv, d_data->scaleStep);
821
d_data->scaleDraw->setTransformation(scaleEngine.transformation());
822
d_data->scaleDraw->setScaleDiv(scaleDiv);
826
//! Return the scale draw
827
QwtDialScaleDraw *QwtDial::scaleDraw()
829
return d_data->scaleDraw;
832
//! Return the scale draw
833
const QwtDialScaleDraw *QwtDial::scaleDraw() const
835
return d_data->scaleDraw;
839
Set an individual scale draw
841
\param scaleDraw Scale draw
842
\warning The previous scale draw is deleted
844
void QwtDial::setScaleDraw(QwtDialScaleDraw *scaleDraw)
846
if ( scaleDraw != d_data->scaleDraw )
848
if ( d_data->scaleDraw )
849
delete d_data->scaleDraw;
851
d_data->scaleDraw = scaleDraw;
858
Change the intervals of the scale
859
\sa QwtAbstractScaleDraw::setScale
861
void QwtDial::setScale(int maxMajIntv, int maxMinIntv, double step)
863
d_data->maxMajIntv = maxMajIntv;
864
d_data->maxMinIntv = maxMinIntv;
865
d_data->scaleStep = step;
871
A wrapper method for accessing the scale draw.
874
No visible scale: setScaleDraw(NULL)
875
- options & ScaleBackbone\n
876
En/disable the backbone of the scale.
877
- options & ScaleTicks\n
878
En/disable the ticks of the scale.
879
- options & ScaleLabel\n
880
En/disable scale labels
882
\sa QwtAbstractScaleDraw::enableComponent
884
void QwtDial::setScaleOptions(int options)
889
QwtDialScaleDraw *sd = d_data->scaleDraw;
893
sd->enableComponent(QwtAbstractScaleDraw::Backbone,
894
options & ScaleBackbone);
896
sd->enableComponent(QwtAbstractScaleDraw::Ticks,
897
options & ScaleTicks);
899
sd->enableComponent(QwtAbstractScaleDraw::Labels,
900
options & ScaleLabel);
903
//! See: QwtAbstractScaleDraw::setTickLength, QwtDialScaleDraw::setPenWidth
904
void QwtDial::setScaleTicks(int minLen, int medLen,
905
int majLen, int penWidth)
907
QwtDialScaleDraw *sd = d_data->scaleDraw;
910
sd->setTickLength(QwtScaleDiv::MinorTick, minLen);
911
sd->setTickLength(QwtScaleDiv::MediumTick, medLen);
912
sd->setTickLength(QwtScaleDiv::MajorTick, majLen);
913
sd->setPenWidth(penWidth);
918
Find the label for a value
923
QwtText QwtDial::scaleLabel(double value) const
930
return QString::number(value);
933
//! \return Lower limit of the scale arc
934
double QwtDial::minScaleArc() const
936
return d_data->minScaleArc;
939
//! \return Upper limit of the scale arc
940
double QwtDial::maxScaleArc() const
942
return d_data->maxScaleArc;
946
\brief Change the origin
948
The origin is the angle where scale and needle is relative to.
950
\param origin New origin
953
void QwtDial::setOrigin(double origin)
955
d_data->origin = origin;
960
The origin is the angle where scale and needle is relative to.
962
\return Origin of the dial
965
double QwtDial::origin() const
967
return d_data->origin;
971
Change the arc of the scale
973
\param minArc Lower limit
974
\param maxArc Upper limit
976
void QwtDial::setScaleArc(double minArc, double maxArc)
978
if ( minArc != 360.0 && minArc != -360.0 )
979
minArc = fmod(minArc, 360.0);
980
if ( maxArc != 360.0 && maxArc != -360.0 )
981
maxArc = fmod(maxArc, 360.0);
983
d_data->minScaleArc = qwtMin(minArc, maxArc);
984
d_data->maxScaleArc = qwtMax(minArc, maxArc);
985
if ( d_data->maxScaleArc - d_data->minScaleArc > 360.0 )
986
d_data->maxScaleArc = d_data->minScaleArc + 360.0;
991
//! QwtDoubleRange update hook
992
void QwtDial::valueChange()
995
QwtAbstractSlider::valueChange();
1001
QSize QwtDial::sizeHint() const
1004
if ( d_data->scaleDraw )
1005
sh = d_data->scaleDraw->extent( QPen(), font() );
1007
const int d = 6 * sh + 2 * lineWidth();
1009
return QSize( d, d );
1013
\brief Return a minimum size hint
1014
\warning The return value of QwtDial::minimumSizeHint() depends on the
1017
QSize QwtDial::minimumSizeHint() const
1020
if ( d_data->scaleDraw )
1021
sh = d_data->scaleDraw->extent(QPen(), font() );
1023
const int d = 3 * sh + 2 * lineWidth();
1025
return QSize( d, d );
1028
static double line2Radians(const QPoint &p1, const QPoint &p2)
1030
const QPoint p = p2 - p1;
1034
angle = ( p.y() <= 0 ) ? M_PI_2 : 3 * M_PI_2;
1037
angle = atan(double(-p.y()) / double(p.x()));
1043
return 360.0 - angle * 180.0 / M_PI;
1047
Find the value for a given position
1052
double QwtDial::getValue(const QPoint &pos)
1054
if ( d_data->maxScaleArc == d_data->minScaleArc || maxValue() == minValue() )
1057
double dir = line2Radians(rect().center(), pos) - d_data->origin;
1061
if ( mode() == RotateScale )
1064
// The position might be in the area that is outside the scale arc.
1065
// We need the range of the scale if it was a complete circle.
1067
const double completeCircle = 360.0 / (d_data->maxScaleArc - d_data->minScaleArc)
1068
* (maxValue() - minValue());
1070
double posValue = minValue() + completeCircle * dir / 360.0;
1072
if ( scrollMode() == ScrMouse )
1074
if ( d_data->previousDir >= 0.0 ) // valid direction
1076
// We have to find out whether the mouse is moving
1077
// clock or counter clockwise
1079
bool clockWise = false;
1081
const double angle = dir - d_data->previousDir;
1082
if ( (angle >= 0.0 && angle <= 180.0) || angle < -180.0 )
1087
if ( dir < d_data->previousDir && mouseOffset() > 0.0 )
1089
// We passed 360 -> 0
1090
setMouseOffset(mouseOffset() - completeCircle);
1095
if ( posValue - mouseOffset() > maxValue() )
1097
// We passed maxValue and the value will be set
1098
// to minValue. We have to adjust the mouseOffset.
1100
setMouseOffset(posValue - minValue());
1105
if ( posValue - mouseOffset() > maxValue() ||
1106
value() == maxValue() )
1108
// We fix the value at maxValue by adjusting
1109
// the mouse offset.
1111
setMouseOffset(posValue - maxValue());
1117
if ( dir > d_data->previousDir && mouseOffset() < 0.0 )
1119
// We passed 0 -> 360
1120
setMouseOffset(mouseOffset() + completeCircle);
1125
if ( posValue - mouseOffset() < minValue() )
1127
// We passed minValue and the value will be set
1128
// to maxValue. We have to adjust the mouseOffset.
1130
setMouseOffset(posValue - maxValue());
1135
if ( posValue - mouseOffset() < minValue() ||
1136
value() == minValue() )
1138
// We fix the value at minValue by adjusting
1139
// the mouse offset.
1141
setMouseOffset(posValue - minValue());
1146
d_data->previousDir = dir;
1153
\sa QwtAbstractSlider::getScrollMode
1155
void QwtDial::getScrollMode(const QPoint &p, int &scrollMode, int &direction)
1158
scrollMode = ScrNone;
1160
const QRegion region(contentsRect(), QRegion::Ellipse);
1161
if ( region.contains(p) && p != rect().center() )
1163
scrollMode = ScrMouse;
1164
d_data->previousDir = -1.0;
1171
- Key_Down, KeyLeft\n
1174
Decrement by pageSize()
1176
Set the value to minValue()
1178
- Key_Up, KeyRight\n
1181
Increment by pageSize()
1183
Set the value to maxValue()
1187
void QwtDial::keyPressEvent(QKeyEvent *e)
1198
double previous = prevValue();
1203
QwtDoubleRange::incValue(-1);
1205
#if QT_VERSION < 0x040000
1208
case Qt::Key_PageUp:
1210
QwtDoubleRange::incValue(-pageSize());
1213
setValue(minValue());
1218
QwtDoubleRange::incValue(1);
1220
#if QT_VERSION < 0x040000
1223
case Qt::Key_PageDown:
1225
QwtDoubleRange::incValue(pageSize());
1228
setValue(maxValue());
1234
if (value() != previous)
1235
emit sliderMoved(value());
1239
\brief Update the mask of the dial
1241
In case of "hasVisibleBackground() == false", the backgound is
1242
transparent by a mask.
1244
\sa showBackground(), hasVisibleBackground()
1246
void QwtDial::updateMask()
1248
if ( d_data->visibleBackground )
1251
setMask(QRegion(boundingRect(), QRegion::Ellipse));