Debugger: Set current tab in separate value display

As widgets are added and deleted from the tab widget, they can end
up in almost any order. As a result, when the window is raised, the
current tab does not necessarily reflect an item currently in the
watch view. Instead, make a tab the current one as it is added,
ensuring one of the currently relevant values is displayed by default.

Change-Id: Ia2d2eb60c844a008f8086820564dd20389ce519b
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Ryan May
2012-12-28 21:29:17 -06:00
committed by hjk
parent f5b0fcfb5d
commit 45cd2d1e8f

View File

@@ -1638,12 +1638,13 @@ void WatchHandler::showSeparateWidget(QWidget *w)
m_separateWindow->setWindowFlags(m_separateWindow->windowFlags() | Qt::Window);
m_separateWindow->setWindowTitle(WatchHandler::tr("Debugger - Qt Creator"));
}
const int index = indexOf(m_separateWindow, w);
int index = indexOf(m_separateWindow, w);
if (index != -1) {
m_separateWindow->setTabText(index, w->windowTitle());
} else {
m_separateWindow->addTab(w, w->windowTitle());
index = m_separateWindow->addTab(w, w->windowTitle());
}
m_separateWindow->setCurrentIndex(index);
m_separateWindow->show();
m_separateWindow->raise();
}