diff --git a/widgets/pushbutton.cpp b/widgets/pushbutton.cpp index eea905afa..9e505b83f 100644 --- a/widgets/pushbutton.cpp +++ b/widgets/pushbutton.cpp @@ -55,8 +55,7 @@ class PushButton::Private }; PushButton::PushButton(QGraphicsItem *parent) - : DataVisualization(), - QGraphicsItem(parent), + : QGraphicsItem(parent), QLayoutItem (Qt::AlignHCenter), d(new Private) { @@ -72,7 +71,7 @@ PushButton::PushButton(QGraphicsItem *parent) d->maxHeight = d->height; setPos(QPointF(0.0,0.0)); d->state = PushButton::None; - d->labelText = tr("Plasma"); + d->labelText = QString("Plasma"); d->labelTextColor = QColor(201,201,255); d->hasIcon = false; d->iconSize = QSize(32,32); @@ -83,6 +82,11 @@ PushButton::~PushButton() delete d; } +void PushButton::data(const DataSource::Data &data) +{ + Q_UNUSED(data) +} + QRectF PushButton::boundingRect() const { return QRectF(x(), y(), d->width, d->height); @@ -108,11 +112,6 @@ void PushButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *option widget-> style()->drawControl(QStyle::CE_PushButton, &options, painter, widget); } - -void PushButton::data(const DataSource::Data&) -{ -} - void PushButton::setText(const QString& text) { d->labelText = text; @@ -199,15 +198,15 @@ void PushButton::mousePressEvent ( QGraphicsSceneMouseEvent * event ) event->accept(); d->state = PushButton::Pressed; update(); - // emit clicked(); +// emit clicked(); } void PushButton::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) { event->accept(); - d->state = PushButton::RELEASED; + d->state = PushButton::Released; update(); - emit clicked(); +// emit clicked(); } QSize PushButton::sizeHint() const diff --git a/widgets/pushbutton.h b/widgets/pushbutton.h index 8a89fff3e..4f7212a67 100644 --- a/widgets/pushbutton.h +++ b/widgets/pushbutton.h @@ -36,7 +36,7 @@ class KDE_EXPORT PushButton : public DataVisualization, public QGraphicsItem, public QLayoutItem { - Q_OBJECT + Q_OBJECT public: enum ButtonShape { @@ -84,17 +84,17 @@ class KDE_EXPORT PushButton : public DataVisualization, virtual QRect geometry() const ; virtual bool isEmpty() const {return false;} - public Q_SLOTS: - void data(const DataSource::Data&); - Q_SIGNALS: void clicked(); + public Q_SLOTS: + virtual void data(const DataSource::Data &); + protected: bool isDown(); void mousePressEvent(QGraphicsSceneMouseEvent *event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); private: class Private ; Private * const d;