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,6 +1179,9 @@ void Containment::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event->isAccepted()) {
|
if (event->isAccepted()) {
|
||||||
|
if (d->dropZoneStarted) {
|
||||||
|
showDropZone(event->pos().toPoint());
|
||||||
|
} else {
|
||||||
if (!d->showDropZoneDelayTimer) {
|
if (!d->showDropZoneDelayTimer) {
|
||||||
d->showDropZoneDelayTimer = new QTimer(this);
|
d->showDropZoneDelayTimer = new QTimer(this);
|
||||||
d->showDropZoneDelayTimer->setInterval(300);
|
d->showDropZoneDelayTimer->setInterval(300);
|
||||||
@ -1190,16 +1193,25 @@ void Containment::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
|
|||||||
d->showDropZoneDelayTimer->start();
|
d->showDropZoneDelayTimer->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Containment::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
|
void Containment::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
|
||||||
{
|
{
|
||||||
|
//kDebug() << event->pos() << size().height() << size().width();
|
||||||
if (d->showDropZoneDelayTimer) {
|
if (d->showDropZoneDelayTimer) {
|
||||||
d->showDropZoneDelayTimer->stop();
|
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()
|
void ContainmentPrivate::showDropZoneDelayed()
|
||||||
{
|
{
|
||||||
|
dropZoneStarted = true;
|
||||||
q->showDropZone(dropPoints.value(0).toPoint());
|
q->showDropZone(dropPoints.value(0).toPoint());
|
||||||
dropPoints.remove(0);
|
dropPoints.remove(0);
|
||||||
}
|
}
|
||||||
@ -1208,6 +1220,7 @@ void Containment::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
|
|||||||
{
|
{
|
||||||
QGraphicsItem *item = scene()->itemAt(event->scenePos());
|
QGraphicsItem *item = scene()->itemAt(event->scenePos());
|
||||||
event->setAccepted(item == this || item == d->toolBox || !item);
|
event->setAccepted(item == this || item == d->toolBox || !item);
|
||||||
|
//kDebug() << event->isAccepted() << d->showDropZoneDelayTimer->isActive();
|
||||||
if (!event->isAccepted()) {
|
if (!event->isAccepted()) {
|
||||||
if (d->showDropZoneDelayTimer) {
|
if (d->showDropZoneDelayTimer) {
|
||||||
d->showDropZoneDelayTimer->stop();
|
d->showDropZoneDelayTimer->stop();
|
||||||
|
@ -52,7 +52,8 @@ public:
|
|||||||
con(0),
|
con(0),
|
||||||
type(Containment::NoContainmentType),
|
type(Containment::NoContainmentType),
|
||||||
showDropZoneDelayTimer(0),
|
showDropZoneDelayTimer(0),
|
||||||
drawWallpaper(true)
|
drawWallpaper(true),
|
||||||
|
dropZoneStarted(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +163,8 @@ public:
|
|||||||
QHash<KJob*, QPointF> dropPoints;
|
QHash<KJob*, QPointF> dropPoints;
|
||||||
QHash<KJob*, KMenu*> dropMenus;
|
QHash<KJob*, KMenu*> dropMenus;
|
||||||
QTimer *showDropZoneDelayTimer;
|
QTimer *showDropZoneDelayTimer;
|
||||||
bool drawWallpaper;
|
bool drawWallpaper : 1;
|
||||||
|
bool dropZoneStarted : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
Loading…
x
Reference in New Issue
Block a user