Skip to content

Commit e36655a

Browse files
Fixed wrong current index when removing a widget from CDockAreaLayout
1 parent ffed6a9 commit e36655a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

examples/deleteonclose/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ int main(int argc, char *argv[])
1111
QMainWindow w;
1212

1313
ads::CDockManager::setConfigFlag(ads::CDockManager::FocusHighlighting, true);
14+
ads::CDockManager::setConfigFlag(ads::CDockManager::AllTabsHaveCloseButton, true);
1415
auto dockManager = new ads::CDockManager(&w);
1516

1617
QAction *action = new QAction("New Delete On Close", &w);

src/DockAreaWidget.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ class CDockAreaLayout
136136
m_CurrentWidget = nullptr;
137137
m_CurrentIndex = -1;
138138
}
139+
else if (indexOf(Widget) < m_CurrentIndex)
140+
{
141+
--m_CurrentIndex;
142+
}
139143
m_Widgets.removeOne(Widget);
140144
}
141145

0 commit comments

Comments
 (0)