only insert a delay before moving the drop zone the first time its shown; be sure to also reset the drop point
svn path=/trunk/KDE/kdelibs/; revision=1045332
This commit is contained in:
parent
5789ff1883
commit
75e482fae2
@ -1179,27 +1179,39 @@ void Containment::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
|
||||
}
|
||||
|
||||
if (event->isAccepted()) {
|
||||
if (!d->showDropZoneDelayTimer) {
|
||||
d->showDropZoneDelayTimer = new QTimer(this);
|
||||
d->showDropZoneDelayTimer->setInterval(300);
|
||||
d->showDropZoneDelayTimer->setSingleShot(true);
|
||||
connect(d->showDropZoneDelayTimer, SIGNAL(timeout()), this, SLOT(showDropZoneDelayed()));
|
||||
}
|
||||
if (d->dropZoneStarted) {
|
||||
showDropZone(event->pos().toPoint());
|
||||
} else {
|
||||
if (!d->showDropZoneDelayTimer) {
|
||||
d->showDropZoneDelayTimer = new QTimer(this);
|
||||
d->showDropZoneDelayTimer->setInterval(300);
|
||||
d->showDropZoneDelayTimer->setSingleShot(true);
|
||||
connect(d->showDropZoneDelayTimer, SIGNAL(timeout()), this, SLOT(showDropZoneDelayed()));
|
||||
}
|
||||
|
||||
d->dropPoints.insert(0, event->pos());
|
||||
d->showDropZoneDelayTimer->start();
|
||||
d->dropPoints.insert(0, event->pos());
|
||||
d->showDropZoneDelayTimer->start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Containment::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
|
||||
{
|
||||
//kDebug() << event->pos() << size().height() << size().width();
|
||||
if (d->showDropZoneDelayTimer) {
|
||||
d->showDropZoneDelayTimer->stop();
|
||||
}
|
||||
|
||||
if (event->pos().y() < 1 || event->pos().y() > size().height() ||
|
||||
event->pos().x() < 1 || event->pos().x() > size().width()) {
|
||||
showDropZone(QPoint());
|
||||
d->dropZoneStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ContainmentPrivate::showDropZoneDelayed()
|
||||
{
|
||||
dropZoneStarted = true;
|
||||
q->showDropZone(dropPoints.value(0).toPoint());
|
||||
dropPoints.remove(0);
|
||||
}
|
||||
@ -1208,6 +1220,7 @@ void Containment::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
|
||||
{
|
||||
QGraphicsItem *item = scene()->itemAt(event->scenePos());
|
||||
event->setAccepted(item == this || item == d->toolBox || !item);
|
||||
//kDebug() << event->isAccepted() << d->showDropZoneDelayTimer->isActive();
|
||||
if (!event->isAccepted()) {
|
||||
if (d->showDropZoneDelayTimer) {
|
||||
d->showDropZoneDelayTimer->stop();
|
||||
|
@ -52,7 +52,8 @@ public:
|
||||
con(0),
|
||||
type(Containment::NoContainmentType),
|
||||
showDropZoneDelayTimer(0),
|
||||
drawWallpaper(true)
|
||||
drawWallpaper(true),
|
||||
dropZoneStarted(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -162,7 +163,8 @@ public:
|
||||
QHash<KJob*, QPointF> dropPoints;
|
||||
QHash<KJob*, KMenu*> dropMenus;
|
||||
QTimer *showDropZoneDelayTimer;
|
||||
bool drawWallpaper;
|
||||
bool drawWallpaper : 1;
|
||||
bool dropZoneStarted : 1;
|
||||
};
|
||||
|
||||
} // Plasma namespace
|
||||
|
Loading…
x
Reference in New Issue
Block a user