Use mouseDoubleClickEvent instead of a custom implementation.
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=759629
This commit is contained in:
parent
06bc11af8c
commit
f46a6a269c
@ -1016,13 +1016,6 @@ 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);
|
||||
}
|
||||
@ -1030,6 +1023,11 @@ void Icon::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
update();
|
||||
}
|
||||
|
||||
void Icon::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
emit doubleClicked();
|
||||
}
|
||||
|
||||
void Icon::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||
{
|
||||
foreach (IconAction *action, d->cornerActions) {
|
||||
|
@ -209,18 +209,18 @@ 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.
|
||||
*/
|
||||
* Indicates when the icon has been double-clicked
|
||||
*/
|
||||
void doubleClicked();
|
||||
|
||||
protected:
|
||||
@ -228,6 +228,7 @@ protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
||||
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
|
@ -23,7 +23,6 @@
|
||||
#define ICON_P_H
|
||||
|
||||
#include <QtCore/QEvent>
|
||||
#include <QtCore/QTime>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtGui/QStyleOptionGraphicsItem>
|
||||
@ -170,7 +169,6 @@ public:
|
||||
QColor shadowColor;
|
||||
QSizeF iconSize;
|
||||
QIcon icon;
|
||||
QTime lastClicked;
|
||||
IconStates states;
|
||||
Qt::Orientation orientation;
|
||||
int numDisplayLines;
|
||||
|
Loading…
x
Reference in New Issue
Block a user