Fixed crash when clicking an extenders dragger without actually dragging, and fixed the 'hand problem'.
svn path=/trunk/KDE/kdelibs/; revision=890806
This commit is contained in:
parent
8328875f4c
commit
e1bb614999
@ -532,14 +532,16 @@ void ExtenderItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
|
|
||||||
d->mousePos = event->pos().toPoint();
|
d->mousePos = event->pos().toPoint();
|
||||||
d->deltaScene = pos();
|
d->deltaScene = pos();
|
||||||
|
d->mousePressed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
void ExtenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if ((d->mousePos - event->pos().toPoint()).manhattanLength()
|
if (!d->dragStarted && (d->mousePos - event->pos().toPoint()).manhattanLength()
|
||||||
>= QApplication::startDragDistance()) {
|
>= QApplication::startDragDistance()) {
|
||||||
d->mousePressed = true;
|
|
||||||
//start the drag:
|
//start the drag:
|
||||||
|
d->dragStarted = true;
|
||||||
|
|
||||||
//set the zValue to the maximum.
|
//set the zValue to the maximum.
|
||||||
d->hostApplet()->raise();
|
d->hostApplet()->raise();
|
||||||
setZValue(d->hostApplet()->zValue());
|
setZValue(d->hostApplet()->zValue());
|
||||||
@ -551,9 +553,7 @@ void ExtenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
d->extender->d->removeExtenderItem(this);
|
d->extender->d->removeExtenderItem(this);
|
||||||
|
|
||||||
d->themeChanged();
|
d->themeChanged();
|
||||||
}
|
} else if (!d->dragStarted) {
|
||||||
|
|
||||||
if (!d->mousePressed) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,8 +700,14 @@ void ExtenderItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||||||
void ExtenderItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
void ExtenderItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (d->mousePressed) {
|
if (d->mousePressed) {
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
}
|
||||||
|
|
||||||
d->mousePressed = false;
|
d->mousePressed = false;
|
||||||
|
|
||||||
|
if (d->dragStarted) {
|
||||||
|
d->dragStarted = false;
|
||||||
|
|
||||||
//remove the toplevel view
|
//remove the toplevel view
|
||||||
if (d->toplevel) {
|
if (d->toplevel) {
|
||||||
delete d->toplevel;
|
delete d->toplevel;
|
||||||
@ -775,8 +781,6 @@ void ExtenderItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
setExtender(extender());
|
setExtender(extender());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,6 +798,7 @@ ExtenderItemPrivate::ExtenderItemPrivate(ExtenderItem *extenderItem, Extender *h
|
|||||||
title(QString()),
|
title(QString()),
|
||||||
mousePressed(false),
|
mousePressed(false),
|
||||||
mouseOver(false),
|
mouseOver(false),
|
||||||
|
dragStarted(false),
|
||||||
destroyActionVisibility(false),
|
destroyActionVisibility(false),
|
||||||
expirationTimer(0)
|
expirationTimer(0)
|
||||||
{
|
{
|
||||||
|
@ -91,6 +91,7 @@ class ExtenderItemPrivate
|
|||||||
|
|
||||||
bool mousePressed;
|
bool mousePressed;
|
||||||
bool mouseOver;
|
bool mouseOver;
|
||||||
|
bool dragStarted;
|
||||||
bool destroyActionVisibility;
|
bool destroyActionVisibility;
|
||||||
|
|
||||||
QTimer *expirationTimer;
|
QTimer *expirationTimer;
|
||||||
|
Loading…
Reference in New Issue
Block a user