Plasma
toolbutton.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PLASMA_TOOLBUTTON_H
00021 #define PLASMA_TOOLBUTTON_H
00022
00023 #include <QtGui/QGraphicsProxyWidget>
00024
00025 class QToolButton;
00026
00027 #include <plasma/plasma_export.h>
00028
00029 namespace Plasma
00030 {
00031
00032 class ToolButtonPrivate;
00033
00039 class PLASMA_EXPORT ToolButton : public QGraphicsProxyWidget
00040 {
00041 Q_OBJECT
00042
00043 Q_PROPERTY(QGraphicsWidget *parentWidget READ parentWidget)
00044 Q_PROPERTY(QString text READ text WRITE setText)
00045 Q_PROPERTY(bool autoRaise READ autoRaise WRITE setAutoRaise)
00046 Q_PROPERTY(QString image READ image WRITE setImage)
00047 Q_PROPERTY(QString stylesheet READ styleSheet WRITE setStyleSheet)
00048 Q_PROPERTY(QToolButton *nativeWidget READ nativeWidget)
00049
00050 public:
00051 explicit ToolButton(QGraphicsWidget *parent = 0);
00052 ~ToolButton();
00053
00059 void setAutoRaise(bool raise);
00060
00064 bool autoRaise() const;
00065
00071 void setText(const QString &text);
00072
00076 QString text() const;
00077
00083 void setImage(const QString &path);
00084
00088 QString image() const;
00089
00095 void setStyleSheet(const QString &stylesheet);
00096
00100 QString styleSheet();
00101
00105 QToolButton *nativeWidget() const;
00106
00107 Q_SIGNALS:
00108 void clicked();
00109
00110 protected:
00111 void paint(QPainter *painter,
00112 const QStyleOptionGraphicsItem *option,
00113 QWidget *widget = 0);
00114 void resizeEvent(QGraphicsSceneResizeEvent *event);
00115 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
00116 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
00117
00118 private:
00119 ToolButtonPrivate *const d;
00120
00121 friend class ToolButtonPrivate;
00122 Q_PRIVATE_SLOT(d, void syncBorders())
00123 Q_PRIVATE_SLOT(d, void animationUpdate(qreal progress))
00124 };
00125
00126 }
00127
00128 #endif // multiple inclusion guard