Commit 577fe8a4 authored by Ryan May's avatar Ryan May Committed by hjk
Browse files

Debugger: Make tabs in separate view closable.



Refactor the separate view from directly using a QTabWidget to a subclass
so that the necessary signal can be hooked up.

Change-Id: Ibc2653d554882a36a85162708021422843057bc1
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent d973448f
......@@ -145,6 +145,26 @@ private:
//
///////////////////////////////////////////////////////////////////////
class SeparateViewWidget : public QTabWidget
{
Q_OBJECT
public:
SeparateViewWidget(QWidget *parent) : QTabWidget(parent)
{
setTabsClosable(true);
connect(this, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int)));
setWindowFlags(windowFlags() | Qt::Window);
setWindowTitle(WatchHandler::tr("Debugger - Qt Creator"));
}
public slots:
void closeTab(int index)
{
removeTab(index);
}
};
class WatchModel : public QAbstractItemModel
{
Q_OBJECT
......@@ -1633,11 +1653,9 @@ void WatchHandler::removeSeparateWidget(QObject *o)
void WatchHandler::showSeparateWidget(QWidget *w)
{
if (m_separateWindow.isNull()) {
m_separateWindow = new QTabWidget(debuggerCore()->mainWindow());
m_separateWindow->setWindowFlags(m_separateWindow->windowFlags() | Qt::Window);
m_separateWindow->setWindowTitle(WatchHandler::tr("Debugger - Qt Creator"));
}
if (m_separateWindow.isNull())
m_separateWindow = new SeparateViewWidget(debuggerCore()->mainWindow());
int index = indexOf(m_separateWindow, w);
if (index != -1) {
m_separateWindow->setTabText(index, w->windowTitle());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment