Added ability to finish reordering in vertical layout from external.
This commit is contained in:
parent
d1619b728e
commit
23009b62ad
2 changed files with 10 additions and 9 deletions
|
|
@ -61,9 +61,7 @@ void VerticalLayoutReorder::start() {
|
||||||
static_cast<QMouseEvent*>(e.get())->globalPos());
|
static_cast<QMouseEvent*>(e.get())->globalPos());
|
||||||
break;
|
break;
|
||||||
case QEvent::MouseButtonRelease:
|
case QEvent::MouseButtonRelease:
|
||||||
mouseRelease(
|
mouseRelease(static_cast<QMouseEvent*>(e.get())->button());
|
||||||
widget,
|
|
||||||
static_cast<QMouseEvent*>(e.get())->button());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}, [=] {
|
}, [=] {
|
||||||
|
|
@ -158,14 +156,11 @@ void VerticalLayoutReorder::mousePress(
|
||||||
_currentStart = position.y();
|
_currentStart = position.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerticalLayoutReorder::mouseRelease(
|
void VerticalLayoutReorder::mouseRelease(Qt::MouseButton button) {
|
||||||
not_null<RpWidget*> widget,
|
|
||||||
Qt::MouseButton button) {
|
|
||||||
if (button != Qt::LeftButton) {
|
if (button != Qt::LeftButton) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_scrollAnimation.stop();
|
finishReordering();
|
||||||
finishCurrent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerticalLayoutReorder::cancelCurrent() {
|
void VerticalLayoutReorder::cancelCurrent() {
|
||||||
|
|
@ -187,6 +182,11 @@ void VerticalLayoutReorder::cancelCurrent(int index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VerticalLayoutReorder::finishReordering() {
|
||||||
|
_scrollAnimation.stop();
|
||||||
|
finishCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
void VerticalLayoutReorder::finishCurrent() {
|
void VerticalLayoutReorder::finishCurrent() {
|
||||||
if (!_currentWidget) {
|
if (!_currentWidget) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ public:
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
void cancel();
|
void cancel();
|
||||||
|
void finishReordering();
|
||||||
[[nodiscard]] rpl::producer<Single> updates() const;
|
[[nodiscard]] rpl::producer<Single> updates() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -50,7 +51,7 @@ private:
|
||||||
not_null<RpWidget*> widget,
|
not_null<RpWidget*> widget,
|
||||||
Qt::MouseButton button,
|
Qt::MouseButton button,
|
||||||
QPoint position);
|
QPoint position);
|
||||||
void mouseRelease(not_null<RpWidget*> widget, Qt::MouseButton button);
|
void mouseRelease(Qt::MouseButton button);
|
||||||
|
|
||||||
void checkForStart(QPoint position);
|
void checkForStart(QPoint position);
|
||||||
void updateOrder(int index, QPoint position);
|
void updateOrder(int index, QPoint position);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue