From kde-commits Thu Jan 10 20:18:11 2008 From: =?utf-8?q?Aaron=20J=2E=20Seigo?= Date: Thu, 10 Jan 2008 20:18:11 +0000 To: kde-commits Subject: KDE/kdebase/workspace/libs/plasma/widgets Message-Id: <1199996291.642821.20548.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=119999635729083 SVN commit 759525 by aseigo: implement a doubleClicked signal. i must admit that using signals that don't exist to implement needed features in applets is an inventive way to force me to implement stuff in libplasma ;) BUG:155413 M +7 -0 icon.cpp M +9 -4 icon.h M +2 -0 icon_p.h --- trunk/KDE/kdebase/workspace/libs/plasma/widgets/icon.cpp #759524:759525 @@ -1016,6 +1016,13 @@ if (!handled) { if (boundingRect().contains(event->pos())) { emit clicked(); + + if (qApp && d->lastClicked.isValid() && d->lastClicked.elapsed() < qApp->doubleClickInterval()) { + emit doubleClicked(); + d->lastClicked = QTime(); + } else { + d->lastClicked.restart(); + } } emit pressed(false); } --- trunk/KDE/kdebase/workspace/libs/plasma/widgets/icon.h #759524:759525 @@ -209,15 +209,20 @@ Q_SIGNALS: /** - * Indicates when the icon has been pressed. - */ + * Indicates when the icon has been pressed. + */ void pressed(bool down); /** - * Indicates when the icon has been clicked. - */ + * Indicates when the icon has been clicked. + */ void clicked(); + /** + * Indicates when the icon has been double clicked. + */ + void doubleClicked(); + protected: bool isDown(); void mousePressEvent(QGraphicsSceneMouseEvent *event); --- trunk/KDE/kdebase/workspace/libs/plasma/widgets/icon_p.h #759524:759525 @@ -23,6 +23,7 @@ #define ICON_P_H #include +#include #include #include #include @@ -169,6 +170,7 @@ QColor shadowColor; QSizeF iconSize; QIcon icon; + QTime lastClicked; IconStates states; Qt::Orientation orientation; int numDisplayLines;