[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/libs/plasma/widgets
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-01-10 20:18:11
Message-ID: 1199996291.642821.20548.nullmailer () svn ! kde ! org
[Download RAW message or body]

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 <QtCore/QEvent>
+#include <QtCore/QTime>
 #include <QtGui/QApplication>
 #include <QtGui/QIcon>
 #include <QtGui/QStyleOptionGraphicsItem>
@@ -169,6 +170,7 @@
     QColor shadowColor;
     QSizeF iconSize;
     QIcon icon;
+    QTime lastClicked;
     IconStates states;
     Qt::Orientation orientation;
     int numDisplayLines;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic