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 svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=759525
This commit is contained in:
parent
12c0a9ae7e
commit
d2a5c1a7af
@ -1016,6 +1016,13 @@ void Icon::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
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);
|
||||
}
|
||||
|
@ -209,15 +209,20 @@ protected:
|
||||
|
||||
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);
|
||||
|
@ -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 @@ public:
|
||||
QColor shadowColor;
|
||||
QSizeF iconSize;
|
||||
QIcon icon;
|
||||
QTime lastClicked;
|
||||
IconStates states;
|
||||
Qt::Orientation orientation;
|
||||
int numDisplayLines;
|
||||
|
Loading…
Reference in New Issue
Block a user