Skip to content

Commit

Permalink
chore: Rename CloseReason::TitleBarButton
Browse files Browse the repository at this point in the history
To CloseReason::TitleBarCloseButton, as there's other buttons capable
of closing the dock widget (like the pin button)
  • Loading branch information
iamsergio committed Apr 2, 2024
1 parent 82136f5 commit fba7cb4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/KDDockWidgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ Q_DECLARE_FLAGS(WindowStates, WindowState)
/// @internal
enum class CloseReason {
Unspecified = 0, /// probably programmatically
TitleBarButton = 1, /// User clicked titlebar close button
Action = 2 /// User clicked menu with QAction
TitleBarCloseButton = 1, /// User clicked titlebar close button
Action = 2, /// User clicked menu with QAction
};

/// @brief Initializes the desired frontend
Expand Down
2 changes: 1 addition & 1 deletion src/core/TitleBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void TitleBar::setIcon(const Icon &icon)

void TitleBar::onCloseClicked()
{
CloseReasonSetter reason(CloseReason::TitleBarButton);
CloseReasonSetter reason(CloseReason::TitleBarCloseButton);

const bool closeOnlyCurrentTab = Config::self().flags() & Config::Flag_CloseOnlyCurrentTab;

Expand Down
2 changes: 1 addition & 1 deletion tests/tst_docks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ KDDW_QCORO_TASK tst_closeReason()
// TitleBar close
dock1->titleBar()->onCloseClicked();
CHECK(!dock1->isOpen());
CHECK_EQ(dock1->lastCloseReason(), CloseReason::TitleBarButton);
CHECK_EQ(dock1->lastCloseReason(), CloseReason::TitleBarCloseButton);

// Programmatic close
dock1->open();
Expand Down

0 comments on commit fba7cb4

Please sign in to comment.