diff --git a/widgets/pushbutton.cpp b/widgets/pushbutton.cpp index 0d9f80eb0..6ddb24db6 100644 --- a/widgets/pushbutton.cpp +++ b/widgets/pushbutton.cpp @@ -24,6 +24,7 @@ #include #include "pushbutton.h" +#include "pushbutton.moc" namespace Plasma { @@ -80,15 +81,7 @@ void PushButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *option options.state = option->state; options.rect = boundingRect().toRect(); options.text = text(); - - if (option->state & QStyle::State_Enabled) { - painter->setPen(option->palette.mid().color()); - painter->setBrush(option->palette.buttonText()); - } else { - painter->setPen(option->palette.buttonText().color()); - painter->setBrush(option->palette.mid()); - } - + widget->style()->drawPrimitive(QStyle::PE_PanelButtonCommand, &options, painter, widget); widget->style()->drawPrimitive(QStyle::PE_FrameFocusRect, &options, painter, widget); widget-> style()->drawControl(QStyle::CE_PushButton, &options, painter, widget); @@ -176,5 +169,6 @@ void PushButton::mousePressEvent ( QGraphicsSceneMouseEvent * event ) event->accept(); d->state = PushButton::PRESSED; update(); + emit clicked(); } } // namespace Plasma diff --git a/widgets/pushbutton.h b/widgets/pushbutton.h index d8f5b3d94..c2b0673b9 100644 --- a/widgets/pushbutton.h +++ b/widgets/pushbutton.h @@ -19,6 +19,7 @@ #ifndef PUSHBUTTON_H #define PUSHBUTTON_H +#include #include #include @@ -31,9 +32,9 @@ namespace Plasma { -class KDE_EXPORT PushButton : public QGraphicsItem, - public DataVisualization +class KDE_EXPORT PushButton : public DataVisualization,public QGraphicsItem { + Q_OBJECT public: typedef enum {RECT=0,ROUND,COUSTOM} ButtonShape; typedef enum {NONE,HOVER,PRESSED,RELEASED} ButtonState; @@ -53,9 +54,9 @@ class KDE_EXPORT PushButton : public QGraphicsItem, int width(); int height(); - public Q_SLOTS: + public slots: void data(const DataSource::Data&); - Q_SIGNALS: + signals: void clicked(); protected: bool isDown();