diff options
Diffstat (limited to 'examples/widgets/widgets/tablet/tabletcanvas.h')
-rw-r--r-- | examples/widgets/widgets/tablet/tabletcanvas.h | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/examples/widgets/widgets/tablet/tabletcanvas.h b/examples/widgets/widgets/tablet/tabletcanvas.h index a7335dbaf0..6044884d32 100644 --- a/examples/widgets/widgets/tablet/tabletcanvas.h +++ b/examples/widgets/widgets/tablet/tabletcanvas.h @@ -61,27 +61,26 @@ class TabletCanvas : public QWidget Q_OBJECT public: - enum AlphaChannelType { AlphaPressure, AlphaTangentialPressure, AlphaTilt, NoAlpha }; - enum ColorSaturationType { SaturationVTilt, SaturationHTilt, - SaturationPressure, NoSaturation }; - enum LineWidthType { LineWidthPressure, LineWidthTilt, NoLineWidth }; + enum Valuator { PressureValuator, TangentialPressureValuator, + TiltValuator, VTiltValuator, HTiltValuator, NoValuator }; + Q_ENUM(Valuator) TabletCanvas(); bool saveImage(const QString &file); bool loadImage(const QString &file); - void setAlphaChannelType(AlphaChannelType type) - { alphaChannelType = type; } - void setColorSaturationType(ColorSaturationType type) - { colorSaturationType = type; } - void setLineWidthType(LineWidthType type) - { lineWidthType = type; } - void setColor(const QColor &color) - { myColor = color; } + void setAlphaChannelValuator(Valuator type) + { m_alphaChannelValuator = type; } + void setColorSaturationValuator(Valuator type) + { m_colorSaturationValuator = type; } + void setLineWidthType(Valuator type) + { m_lineWidthValuator = type; } + void setColor(const QColor &c) + { if (c.isValid()) m_color = c; } QColor color() const - { return myColor; } + { return m_color; } void setTabletDevice(QTabletEvent *event) - { myTabletDevice = event->device(); updateCursor(event); } + { updateCursor(event); } int maximum(int a, int b) { return a > b ? a : b; } @@ -97,17 +96,14 @@ private: void updateBrush(const QTabletEvent *event); void updateCursor(const QTabletEvent *event); - AlphaChannelType alphaChannelType; - ColorSaturationType colorSaturationType; - LineWidthType lineWidthType; - QTabletEvent::PointerType pointerType; - QTabletEvent::TabletDevice myTabletDevice; - QColor myColor; - - QPixmap pixmap; - QBrush myBrush; - QPen myPen; - bool deviceDown; + Valuator m_alphaChannelValuator; + Valuator m_colorSaturationValuator; + Valuator m_lineWidthValuator; + QColor m_color; + QPixmap m_pixmap; + QBrush m_brush; + QPen m_pen; + bool m_deviceDown; struct Point { QPointF pos; |