Skip to content

Commit

Permalink
chore: Rename PinButton to MovedToSideBar
Browse files Browse the repository at this point in the history
As the dock widget can move to sidebar programatically too, without
any pin button involved
  • Loading branch information
iamsergio committed Apr 2, 2024
1 parent 84928bb commit 0305548
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/KDDockWidgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ enum class CloseReason {
Unspecified = 0, /// probably programmatically
TitleBarCloseButton = 1, /// User clicked titlebar close button
Action = 2, /// User clicked menu with QAction
PinButton = 4, /// User clicked the pin-button (auto-hide/sidebar/pin-unpin functionallity)
MovedToSideBar = 4, /// User clicked the pin-button (or programatically) (auto-hide/sidebar/pin-unpin functionallity)
OverlayCollapse = 8 /// Dock widget went from overlay to sidebar (auto-hide/sidebar/pin-unpin functionallity)
};

Expand Down
2 changes: 1 addition & 1 deletion src/core/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ void MainWindow::moveToSideBar(Core::DockWidget *dw, SideBarLocation location)

if (Core::SideBar *sb = sideBar(location)) {
ScopedValueRollback rollback(dw->d->m_isMovingToSideBar, true);
CloseReasonSetter reason(CloseReason::PinButton);
CloseReasonSetter reason(CloseReason::MovedToSideBar);
dw->forceClose();
sb->addDockWidget(dw);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/core/TitleBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ void TitleBar::onAutoHideClicked()
registry->addSideBarGrouping(dockwidgets);


CloseReasonSetter reason(CloseReason::PinButton);
CloseReasonSetter reason(CloseReason::MovedToSideBar);
for (DockWidget *dw : dockwidgets) {
if (groupedAutoHide || dw == currentDw)
dw->moveToSideBar();
Expand Down
4 changes: 2 additions & 2 deletions tests/qtwidgets/tst_qtwidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ void TestQtWidgets::tst_sidebarCloseReason()
Q_ASSERT(dw1->lastCloseReason() == expectedLastReason);
});

expectedLastReason = CloseReason::PinButton;
expectedLastReason = CloseReason::MovedToSideBar;
dw1->titleBar()->onAutoHideClicked();
QVERIFY(dw1->isInSideBar());
QVERIFY(!dw1->isOpen());
Expand All @@ -1234,7 +1234,7 @@ void TestQtWidgets::tst_sidebarCloseReason()
dw1->titleBar()->onCloseClicked();
QCOMPARE(dw1->lastCloseReason(), expectedLastReason);

expectedLastReason = CloseReason::PinButton;
expectedLastReason = CloseReason::MovedToSideBar;
dw1->open();
m1->moveToSideBar(dw1);
QCOMPARE(dw1->lastCloseReason(), expectedLastReason);
Expand Down

0 comments on commit 0305548

Please sign in to comment.