Tab drags: the three-point threshold, an unheld move and stacking pinned; no minimum hint (13.14)
This commit is contained in:
1 parent
01bb579068
commit
5be68a4f96
3 files changed
+10
-7
No files matched your search
@@ -24,11 +24,6 @@ QSize ProjectTabStrip::sizeHint() const
|
|||||||
return {int(std::ceil(projectTabOverflow(order, widths(), m_workspace.selectedID(), 0, &OverflowTabsPill::pillWidth).contentWidth())), 34};
|
return {int(std::ceil(projectTabOverflow(order, widths(), m_workspace.selectedID(), 0, &OverflowTabsPill::pillWidth).contentWidth())), 34};
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize ProjectTabStrip::minimumSizeHint() const
|
|
||||||
{
|
|
||||||
return {0, 34};
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<ProjectTabButton *> ProjectTabStrip::buttons() const
|
QList<ProjectTabButton *> ProjectTabStrip::buttons() const
|
||||||
{
|
{
|
||||||
return QList<ProjectTabButton *>(m_buttons.begin(), m_buttons.end());
|
return QList<ProjectTabButton *>(m_buttons.begin(), m_buttons.end());
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ public:
|
|||||||
OverflowTabsPill *pill() const { return m_pill; }
|
OverflowTabsPill *pill() const { return m_pill; }
|
||||||
|
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
QSize minimumSizeHint() const override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ void ProjectTabDragTests::aDraggedTabFollowsThePointerAndLandsInTheGap()
|
|||||||
// Two points stay a press; three drag, and select.
|
// Two points stay a press; three drag, and select.
|
||||||
fixture.move(start + QPoint(2, 0));
|
fixture.move(start + QPoint(2, 0));
|
||||||
QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[2]->id);
|
QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[2]->id);
|
||||||
|
fixture.move(start + QPoint(3, 0));
|
||||||
|
QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[0]->id);
|
||||||
fixture.move(start + QPoint(40, 0));
|
fixture.move(start + QPoint(40, 0));
|
||||||
QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[0]->id);
|
QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[0]->id);
|
||||||
QCOMPARE(first.x(), 40);
|
QCOMPARE(first.x(), 40);
|
||||||
@@ -104,10 +106,11 @@ void ProjectTabDragTests::aDraggedTabFollowsThePointerAndLandsInTheGap()
|
|||||||
QVERIFY(slide && slide->duration() == 150 && slide->easingCurve() == QEasingCurve::OutQuad);
|
QVERIFY(slide && slide->duration() == 150 && slide->easingCurve() == QEasingCurve::OutQuad);
|
||||||
QCOMPARE(slide->endValue().toPoint(), QPoint(0, 3));
|
QCOMPARE(slide->endValue().toPoint(), QPoint(0, 3));
|
||||||
QVERIFY(!first.findChild<QPropertyAnimation *>() && !third.findChild<QPropertyAnimation *>());
|
QVERIFY(!first.findChild<QPropertyAnimation *>() && !third.findChild<QPropertyAnimation *>());
|
||||||
|
QTRY_VERIFY(settled(fixture.strip));
|
||||||
// The dragged tab lies over the one it crosses.
|
// The dragged tab lies over the one it crosses.
|
||||||
|
QVERIFY(first.x() < second.x() + second.width());
|
||||||
QWidget *hit = fixture.strip.childAt(first.x() + 2, 14);
|
QWidget *hit = fixture.strip.childAt(first.x() + 2, 14);
|
||||||
QVERIFY(hit == &first || first.isAncestorOf(hit));
|
QVERIFY(hit == &first || first.isAncestorOf(hit));
|
||||||
QTRY_VERIFY(settled(fixture.strip));
|
|
||||||
QCOMPARE(second.x(), 0);
|
QCOMPARE(second.x(), 0);
|
||||||
QCOMPARE(third.x(), w1 + 6 + w2 + 6);
|
QCOMPARE(third.x(), w1 + 6 + w2 + 6);
|
||||||
// Far right: held at the row's end, the others compacted.
|
// Far right: held at the row's end, the others compacted.
|
||||||
@@ -155,6 +158,12 @@ void ProjectTabDragTests::aSmallOrUpwardMoveIsAClick()
|
|||||||
fixture.move(start + QPoint(2, -3));
|
fixture.move(start + QPoint(2, -3));
|
||||||
QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[2]->id);
|
QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[2]->id);
|
||||||
QCOMPARE(button(fixture.strip, "Untitled").x(), 0);
|
QCOMPARE(button(fixture.strip, "Untitled").x(), 0);
|
||||||
|
// A move with the button let go unseen drags nothing.
|
||||||
|
QMouseEvent unheld(QEvent::MouseMove, QPointF(fixture.pressed->mapFrom(&fixture.strip, start + QPoint(200, 0))),
|
||||||
|
QPointF(fixture.pressed->mapToGlobal(fixture.pressed->mapFrom(&fixture.strip, start + QPoint(200, 0)))), Qt::NoButton,
|
||||||
|
Qt::NoButton, Qt::NoModifier);
|
||||||
|
QApplication::sendEvent(fixture.pressed, &unheld);
|
||||||
|
QCOMPARE(button(fixture.strip, "Untitled").x(), 0);
|
||||||
fixture.release("Untitled", start + QPoint(2, -3));
|
fixture.release("Untitled", start + QPoint(2, -3));
|
||||||
// The click selects; the order stays.
|
// The click selects; the order stays.
|
||||||
QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[0]->id);
|
QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[0]->id);
|
||||||
|
|||||||
Reference in new issue
Block a user