16 #include "Base/Util/Assert.h"
18 #include <QMouseEvent>
19 #include <QPropertyAnimation>
20 #include <QScrollArea>
25 , m_widgetToMove(widgetToMove)
26 , m_dropAboveThisWidget(nullptr)
27 , m_ignoreOnTop(ignoreOnTop)
28 , m_scrollArea(nullptr)
30 setIcon(QIcon(
":/images/move_up_down.svg"));
37 QWidget* p = parentWidget();
40 p = p->parentWidget();
99 const bool movedWidgetIsAboveThisLayoutItem =
100 m_widgetToMove->y() < yTopOfLayoutItem + layoutItem->geometry().height() / 2;
101 if (movedWidgetIsAboveThisLayoutItem && layoutItem->widget() !=
nullptr
105 QRect r = layoutItem->geometry();
106 if (movedWidgetIsAboveThisLayoutItem)
110 r.moveTop(yTopOfLayoutItem);
112 if (r != layoutItem->geometry()) {
113 QWidget* w = layoutItem->widget();
115 layoutItem->setGeometry(r);
117 auto* animation =
new QPropertyAnimation(w,
"geometry");
118 animation->setDuration(100);
119 animation->setEasingCurve(QEasingCurve::OutQuad);
120 animation->setStartValue(w->geometry());
121 animation->setEndValue(r);
126 if (animation->endValue() != r) {
128 animation->setStartValue(w->geometry());
129 animation->setEndValue(r);
139 QPoint parPos =
m_scrollArea->mapFromGlobal(mapToGlobal(event->pos()));
140 if (parPos.y() < 20) {
158 if (!scrollbar->isVisible())
161 const int oldScrollValue = scrollbar->value();
162 scrollbar->setValue(oldScrollValue + (up ? -5 : 5));