From kde-commits Thu Jan 10 23:29:07 2008 From: Christopher Blauvelt Date: Thu, 10 Jan 2008 23:29:07 +0000 To: kde-commits Subject: KDE/kdebase/workspace/libs/plasma/widgets Message-Id: <1200007747.153204.32590.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=120000775515531 SVN commit 759629 by cblauvelt: Use mouseDoubleClickEvent instead of a custom implementation. M +5 -7 icon.cpp M +7 -6 icon.h M +0 -2 icon_p.h --- trunk/KDE/kdebase/workspace/libs/plasma/widgets/icon.cpp #759628:759629 @@ -1016,13 +1016,6 @@ 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); } @@ -1030,6 +1023,11 @@ update(); } +void Icon::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) +{ + emit doubleClicked(); +} + void Icon::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { foreach (IconAction *action, d->cornerActions) { --- trunk/KDE/kdebase/workspace/libs/plasma/widgets/icon.h #759628:759629 @@ -209,18 +209,18 @@ 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. - */ + * Indicates when the icon has been double-clicked + */ void doubleClicked(); protected: @@ -228,6 +228,7 @@ void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); --- trunk/KDE/kdebase/workspace/libs/plasma/widgets/icon_p.h #759628:759629 @@ -23,7 +23,6 @@ #define ICON_P_H #include -#include #include #include #include @@ -170,7 +169,6 @@ QColor shadowColor; QSizeF iconSize; QIcon icon; - QTime lastClicked; IconStates states; Qt::Orientation orientation; int numDisplayLines;