From e36655a7ab1af5e4d0d2f370f9427d4013f2041a Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Sun, 14 Jun 2020 16:12:56 +0200 Subject: [PATCH] Fixed wrong current index when removing a widget from CDockAreaLayout --- examples/deleteonclose/main.cpp | 1 + src/DockAreaWidget.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/examples/deleteonclose/main.cpp b/examples/deleteonclose/main.cpp index 2f08ffe..d4da8c1 100644 --- a/examples/deleteonclose/main.cpp +++ b/examples/deleteonclose/main.cpp @@ -11,6 +11,7 @@ int main(int argc, char *argv[]) QMainWindow w; ads::CDockManager::setConfigFlag(ads::CDockManager::FocusHighlighting, true); + ads::CDockManager::setConfigFlag(ads::CDockManager::AllTabsHaveCloseButton, true); auto dockManager = new ads::CDockManager(&w); QAction *action = new QAction("New Delete On Close", &w); diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index dcbef60..d762b84 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -136,6 +136,10 @@ public: m_CurrentWidget = nullptr; m_CurrentIndex = -1; } + else if (indexOf(Widget) < m_CurrentIndex) + { + --m_CurrentIndex; + } m_Widgets.removeOne(Widget); }