diff options
Diffstat (limited to 'examples/graphicsview/padnavigator/roundrectitem.h')
-rw-r--r-- | examples/graphicsview/padnavigator/roundrectitem.h | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/examples/graphicsview/padnavigator/roundrectitem.h b/examples/graphicsview/padnavigator/roundrectitem.h index 683c09f..bc58cec 100644 --- a/examples/graphicsview/padnavigator/roundrectitem.h +++ b/examples/graphicsview/padnavigator/roundrectitem.h @@ -39,45 +39,38 @@ ** ****************************************************************************/ -#include <QtCore/qobject.h> -#include <QtCore/qtimeline.h> -#include <QtGui/qgraphicsitem.h> -#include <QtGui/qbrush.h> +#ifndef ROUNDRECTITEM_H +#define ROUNDRECTITEM_H -QT_BEGIN_NAMESPACE -class QGraphicsProxyWidget; -QT_END_NAMESPACE +#include <QGraphicsObject> +#include <QLinearGradient> -class RoundRectItem : public QObject, public QGraphicsRectItem +//! [0] +class RoundRectItem : public QGraphicsObject { Q_OBJECT + Q_PROPERTY(bool fill READ fill WRITE setFill) public: - RoundRectItem(const QRectF &rect, const QBrush &brush, QWidget *embeddedWidget = 0); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *); - QRectF boundingRect() const; + RoundRectItem(const QRectF &bounds, const QColor &color, + QGraphicsItem *parent = 0); + QPixmap pixmap() const; void setPixmap(const QPixmap &pixmap); - qreal opacity() const; - void setOpacity(qreal opacity); - -Q_SIGNALS: - void activated(); - -protected: - void keyPressEvent(QKeyEvent *event); - void keyReleaseEvent(QKeyEvent *event); + QRectF boundingRect() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); -private slots: - void updateValue(qreal value); + bool fill() const; + void setFill(bool fill); +//! [0] +//! [1] private: - QBrush brush; QPixmap pix; - QTimeLine timeLine; - qreal lastVal; - qreal opa; - - QGraphicsProxyWidget *proxyWidget; + bool fillRect; + QRectF bounds; + QLinearGradient gradient; }; +//! [1] + +#endif // ROUNDRECTITEM_H |