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:
Rob Scheepmaker 2008-11-30 11:45:23 +00:00
parent 8328875f4c
commit e1bb614999
2 changed files with 15 additions and 9 deletions

View File

@ -532,14 +532,16 @@ void ExtenderItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
d->mousePos = event->pos().toPoint();
d->deltaScene = pos();
d->mousePressed = true;
}
void ExtenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if ((d->mousePos - event->pos().toPoint()).manhattanLength()
if (!d->dragStarted && (d->mousePos - event->pos().toPoint()).manhattanLength()
>= QApplication::startDragDistance()) {
d->mousePressed = true;
//start the drag:
d->dragStarted = true;
//set the zValue to the maximum.
d->hostApplet()->raise();
setZValue(d->hostApplet()->zValue());
@ -551,9 +553,7 @@ void ExtenderItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
d->extender->d->removeExtenderItem(this);
d->themeChanged();
}
if (!d->mousePressed) {
} else if (!d->dragStarted) {
return;
}
@ -700,8 +700,14 @@ void ExtenderItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
void ExtenderItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (d->mousePressed) {
QApplication::restoreOverrideCursor();
}
d->mousePressed = false;
if (d->dragStarted) {
d->dragStarted = false;
//remove the toplevel view
if (d->toplevel) {
delete d->toplevel;
@ -775,8 +781,6 @@ void ExtenderItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
setExtender(extender());
}
}
QApplication::restoreOverrideCursor();
}
}
@ -794,6 +798,7 @@ ExtenderItemPrivate::ExtenderItemPrivate(ExtenderItem *extenderItem, Extender *h
title(QString()),
mousePressed(false),
mouseOver(false),
dragStarted(false),
destroyActionVisibility(false),
expirationTimer(0)
{

View File

@ -91,6 +91,7 @@ class ExtenderItemPrivate
bool mousePressed;
bool mouseOver;
bool dragStarted;
bool destroyActionVisibility;
QTimer *expirationTimer;