diff options
author | Ryan May <[email protected]> | 2012-12-30 22:35:25 -0600 |
---|---|---|
committer | hjk <[email protected]> | 2013-01-01 01:09:31 +0100 |
commit | 577fe8a49fdbe10f506cf5885d4647f959c3b31a (patch) | |
tree | dd00423fb37c5633c9f015a532435be30b642185 /src/plugins/debugger/watchhandler.cpp | |
parent | d973448f74e0a47c42172ddf0fd94e210b682d19 (diff) |
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: hjk <[email protected]>
Diffstat (limited to 'src/plugins/debugger/watchhandler.cpp')
-rw-r--r-- | src/plugins/debugger/watchhandler.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 5f54e404190..f4056390208 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -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()); |