forked from qt-creator/qt-creator
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 <qthjk@ovi.com>
This commit is contained in:
@@ -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
|
class WatchModel : public QAbstractItemModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -1633,11 +1653,9 @@ void WatchHandler::removeSeparateWidget(QObject *o)
|
|||||||
|
|
||||||
void WatchHandler::showSeparateWidget(QWidget *w)
|
void WatchHandler::showSeparateWidget(QWidget *w)
|
||||||
{
|
{
|
||||||
if (m_separateWindow.isNull()) {
|
if (m_separateWindow.isNull())
|
||||||
m_separateWindow = new QTabWidget(debuggerCore()->mainWindow());
|
m_separateWindow = new SeparateViewWidget(debuggerCore()->mainWindow());
|
||||||
m_separateWindow->setWindowFlags(m_separateWindow->windowFlags() | Qt::Window);
|
|
||||||
m_separateWindow->setWindowTitle(WatchHandler::tr("Debugger - Qt Creator"));
|
|
||||||
}
|
|
||||||
int index = indexOf(m_separateWindow, w);
|
int index = indexOf(m_separateWindow, w);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
m_separateWindow->setTabText(index, w->windowTitle());
|
m_separateWindow->setTabText(index, w->windowTitle());
|
||||||
|
|||||||
Reference in New Issue
Block a user