scroll around while dragging items on the extender, to make possible drop the item on any point
svn path=/trunk/KDE/kdelibs/; revision=1186504
This commit is contained in:
parent
5d452a0429
commit
6ad3371e9a
@ -421,6 +421,8 @@ void Extender::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
|
|||||||
|
|
||||||
if (mimeData) {
|
if (mimeData) {
|
||||||
itemHoverMoveEvent(mimeData->extenderItem(), event->pos());
|
itemHoverMoveEvent(mimeData->extenderItem(), event->pos());
|
||||||
|
|
||||||
|
d->setPositionFromDragPosition(event->scenePos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -837,6 +839,13 @@ void ExtenderPrivate::adjustMinimumSize()
|
|||||||
scrollWidget->setMinimumHeight(qMin((qreal)300, mainWidget->effectiveSizeHint(Qt::MinimumSize).height()));
|
scrollWidget->setMinimumHeight(qMin((qreal)300, mainWidget->effectiveSizeHint(Qt::MinimumSize).height()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExtenderPrivate::setPositionFromDragPosition(const QPointF &pos)
|
||||||
|
{
|
||||||
|
const qreal ratio = (q->mapFromScene(pos).y()/scrollWidget->size().height());
|
||||||
|
|
||||||
|
mainWidget->setPos(mainWidget->pos().x(), 30 + (ratio *(scrollWidget->size().height() - mainWidget->size().height() - 30)));
|
||||||
|
}
|
||||||
|
|
||||||
ExtenderGroup *ExtenderPrivate::findGroup(const QString &name) const
|
ExtenderGroup *ExtenderPrivate::findGroup(const QString &name) const
|
||||||
{
|
{
|
||||||
foreach (ExtenderItem *item, attachedExtenderItems) {
|
foreach (ExtenderItem *item, attachedExtenderItems) {
|
||||||
|
@ -266,6 +266,8 @@ void ExtenderGroup::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
|
|||||||
d->spacerWidget = widget;
|
d->spacerWidget = widget;
|
||||||
}
|
}
|
||||||
d->layout->insertItem(insertIndex, d->spacerWidget);
|
d->layout->insertItem(insertIndex, d->spacerWidget);
|
||||||
|
|
||||||
|
extender()->d->setPositionFromDragPosition(event->scenePos());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ class ExtenderPrivate
|
|||||||
void delayItemAddedEvent();
|
void delayItemAddedEvent();
|
||||||
void updateEmptyExtenderLabel();
|
void updateEmptyExtenderLabel();
|
||||||
void adjustMinimumSize();
|
void adjustMinimumSize();
|
||||||
|
void setPositionFromDragPosition(const QPointF &pos);
|
||||||
ExtenderGroup *findGroup(const QString &name) const;
|
ExtenderGroup *findGroup(const QString &name) const;
|
||||||
|
|
||||||
Extender *q;
|
Extender *q;
|
||||||
|
Loading…
Reference in New Issue
Block a user