summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2011-09-30 12:28:55 +0200
committerhjk <qthjk@ovi.com>2011-09-30 12:31:29 +0200
commit2e9fd40d866c49018157b7654e08eb92ddea0ec0 (patch)
treec4bc6797fb6fcf3a40bcfcc466d93c7bb28084c7
parent1b5e10e1b66961f6bf07fe4d1a24ccc540447f39 (diff)
downloadqt-creator-2e9fd40d866c49018157b7654e08eb92ddea0ec0.tar.gz
debugger: use common baseclass for all dock treeviews
Reduces amount of boilerplate code. Change-Id: I048d901b4b80860df05f09b48650ea58b83fbc66 Reviewed-on: http://codereview.qt-project.org/5864 Reviewed-by: hjk <qthjk@ovi.com>
-rw-r--r--src/plugins/debugger/basewindow.cpp125
-rw-r--r--src/plugins/debugger/basewindow.h71
-rw-r--r--src/plugins/debugger/breakwindow.cpp53
-rw-r--r--src/plugins/debugger/breakwindow.h12
-rw-r--r--src/plugins/debugger/debugger.pro8
-rw-r--r--src/plugins/debugger/moduleswindow.cpp54
-rw-r--r--src/plugins/debugger/moduleswindow.h8
-rw-r--r--src/plugins/debugger/registerwindow.cpp50
-rw-r--r--src/plugins/debugger/registerwindow.h10
-rw-r--r--src/plugins/debugger/snapshotwindow.cpp55
-rw-r--r--src/plugins/debugger/snapshotwindow.h14
-rw-r--r--src/plugins/debugger/sourcefileswindow.cpp35
-rw-r--r--src/plugins/debugger/sourcefileswindow.h9
-rw-r--r--src/plugins/debugger/stackwindow.cpp57
-rw-r--r--src/plugins/debugger/stackwindow.h11
-rw-r--r--src/plugins/debugger/threadswindow.cpp55
-rw-r--r--src/plugins/debugger/threadswindow.h13
-rw-r--r--src/plugins/debugger/watchwindow.cpp54
-rw-r--r--src/plugins/debugger/watchwindow.h9
19 files changed, 280 insertions, 423 deletions
diff --git a/src/plugins/debugger/basewindow.cpp b/src/plugins/debugger/basewindow.cpp
new file mode 100644
index 0000000000..84f084815d
--- /dev/null
+++ b/src/plugins/debugger/basewindow.cpp
@@ -0,0 +1,125 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#include "basewindow.h"
+
+#include "debuggeractions.h"
+#include "debuggercore.h"
+
+#include <utils/savedaction.h>
+
+#include <QtCore/QDebug>
+#include <QtGui/QContextMenuEvent>
+#include <QtGui/QHeaderView>
+#include <QtGui/QMenu>
+
+namespace Debugger {
+namespace Internal {
+
+BaseWindow::BaseWindow(QWidget *parent)
+ : QTreeView(parent)
+{
+ QAction *act = debuggerCore()->action(UseAlternatingRowColors);
+
+ setAttribute(Qt::WA_MacShowFocusRect, false);
+ setFrameStyle(QFrame::NoFrame);
+ setAlternatingRowColors(act->isChecked());
+ setRootIsDecorated(false);
+ setIconSize(QSize(10, 10));
+ setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+ header()->setDefaultAlignment(Qt::AlignLeft);
+
+ connect(act, SIGNAL(toggled(bool)),
+ SLOT(setAlternatingRowColorsHelper(bool)));
+ connect(this, SIGNAL(activated(QModelIndex)),
+ SLOT(rowActivatedHelper(QModelIndex)));
+
+ m_adjustColumnsAction = new QAction(tr("Adjust Column Widths to Contents"), 0);
+ m_alwaysAdjustColumnsAction = 0;
+}
+
+void BaseWindow::setAlwaysAdjustColumnsAction(QAction *action)
+{
+ m_alwaysAdjustColumnsAction = action;
+ connect(action, SIGNAL(toggled(bool)),
+ SLOT(setAlwaysResizeColumnsToContents(bool)));
+}
+
+void BaseWindow::addBaseContextActions(QMenu *menu)
+{
+ menu->addSeparator();
+ if (m_alwaysAdjustColumnsAction)
+ menu->addAction(m_alwaysAdjustColumnsAction);
+ menu->addAction(m_adjustColumnsAction);
+ menu->addSeparator();
+ menu->addAction(debuggerCore()->action(SettingsDialog));
+}
+
+bool BaseWindow::handleBaseContextAction(QAction *act)
+{
+ if (act == 0)
+ return true;
+ if (act == m_adjustColumnsAction) {
+ resizeColumnsToContents();
+ return true;
+ }
+ if (act == m_alwaysAdjustColumnsAction) {
+ // Action triggered automatically.
+ return true;
+ }
+ return false;
+}
+
+void BaseWindow::setModel(QAbstractItemModel *model)
+{
+ QTreeView::setModel(model);
+ if (header() && m_alwaysAdjustColumnsAction)
+ setAlwaysResizeColumnsToContents(m_alwaysAdjustColumnsAction->isChecked());
+}
+
+void BaseWindow::resizeColumnsToContents()
+{
+ const int columnCount = model()->columnCount();
+ for (int c = 0 ; c != columnCount; ++c)
+ resizeColumnToContents(c);
+}
+
+void BaseWindow::setAlwaysResizeColumnsToContents(bool on)
+{
+ QHeaderView::ResizeMode mode = on
+ ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
+ header()->setResizeMode(0, mode);
+}
+
+} // namespace Internal
+} // namespace Debugger
diff --git a/src/plugins/debugger/basewindow.h b/src/plugins/debugger/basewindow.h
new file mode 100644
index 0000000000..03b9791eae
--- /dev/null
+++ b/src/plugins/debugger/basewindow.h
@@ -0,0 +1,71 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (info@qt.nokia.com)
+**
+**
+** GNU Lesser General Public License Usage
+**
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this file.
+** Please review the following information to ensure the GNU Lesser General
+** Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** Other Usage
+**
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
+**
+**************************************************************************/
+
+#ifndef DEBUGGER_BASEWINDOW_H
+#define DEBUGGER_BASEWINDOW_H
+
+#include <QtGui/QTreeView>
+
+namespace Debugger {
+namespace Internal {
+
+class BaseWindow : public QTreeView
+{
+ Q_OBJECT
+
+public:
+ BaseWindow(QWidget *parent = 0);
+
+ void setAlwaysAdjustColumnsAction(QAction *action);
+ void addBaseContextActions(QMenu *menu);
+ bool handleBaseContextAction(QAction *action);
+
+ void setModel(QAbstractItemModel *model);
+ virtual void rowActivated(const QModelIndex &) {}
+
+public slots:
+ void resizeColumnsToContents();
+ void setAlwaysResizeColumnsToContents(bool on);
+
+private slots:
+ void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
+ void rowActivatedHelper(const QModelIndex &index) { rowActivated(index); }
+
+private:
+ QAction *m_alwaysAdjustColumnsAction;
+ QAction *m_adjustColumnsAction;
+};
+
+} // namespace Internal
+} // namespace Debugger
+
+#endif // DEBUGGER_BASEWINDOW_H
diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp
index cb2b10cb1d..a62302ffbf 100644
--- a/src/plugins/debugger/breakwindow.cpp
+++ b/src/plugins/debugger/breakwindow.cpp
@@ -469,28 +469,15 @@ MultiBreakPointsDialog::MultiBreakPointsDialog(unsigned engineCapabilities, QWid
///////////////////////////////////////////////////////////////////////
BreakWindow::BreakWindow(QWidget *parent)
- : QTreeView(parent)
+ : BaseWindow(parent)
{
- QAction *act = debuggerCore()->action(UseAlternatingRowColors);
- setFrameStyle(QFrame::NoFrame);
- setAttribute(Qt::WA_MacShowFocusRect, false);
setWindowTitle(tr("Breakpoints"));
+ setObjectName(QLatin1String("ThreadsWindow"));
setWindowIcon(QIcon(QLatin1String(":/debugger/images/debugger_breakpoints.png")));
- setAlternatingRowColors(act->isChecked());
- setRootIsDecorated(false);
- setIconSize(QSize(10, 10));
setSelectionMode(QAbstractItemView::ExtendedSelection);
-
- connect(this, SIGNAL(activated(QModelIndex)),
- SLOT(rowActivated(QModelIndex)));
- connect(act, SIGNAL(toggled(bool)),
- SLOT(setAlternatingRowColorsHelper(bool)));
+ setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths));
connect(debuggerCore()->action(UseAddressInBreakpointsView),
- SIGNAL(toggled(bool)),
- SLOT(showAddressColumn(bool)));
- connect(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths),
- SIGNAL(toggled(bool)),
- SLOT(setAlwaysResizeColumnsToContents(bool)));
+ SIGNAL(toggled(bool)), SLOT(showAddressColumn(bool)));
}
void BreakWindow::showAddressColumn(bool on)
@@ -514,11 +501,6 @@ void BreakWindow::keyPressEvent(QKeyEvent *ev)
QTreeView::keyPressEvent(ev);
}
-void BreakWindow::resizeEvent(QResizeEvent *ev)
-{
- QTreeView::resizeEvent(ev);
-}
-
void BreakWindow::mouseDoubleClickEvent(QMouseEvent *ev)
{
QModelIndex indexUnderMouse = indexAt(ev->pos());
@@ -531,14 +513,10 @@ void BreakWindow::mouseDoubleClickEvent(QMouseEvent *ev)
void BreakWindow::setModel(QAbstractItemModel *model)
{
- QTreeView::setModel(model);
+ BaseWindow::setModel(model);
resizeColumnToContents(0); // Number
resizeColumnToContents(3); // Line
resizeColumnToContents(6); // Ignore count
- if (header()) {
- bool adjust = debuggerCore()->boolSetting(AlwaysAdjustBreakpointsColumnWidths);
- setAlwaysResizeColumnsToContents(adjust);
- }
connect(model, SIGNAL(layoutChanged()), this, SLOT(expandAll()));
}
@@ -631,10 +609,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addSeparator();
menu.addAction(debuggerCore()->action(UseToolTipsInBreakpointsView));
menu.addAction(debuggerCore()->action(UseAddressInBreakpointsView));
- menu.addAction(adjustColumnAction);
- menu.addAction(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths));
- menu.addSeparator();
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ addBaseContextActions(&menu);
QAction *act = menu.exec(ev->globalPos());
@@ -656,6 +631,8 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
setBreakpointsEnabled(selectedIds, !enabled);
else if (act == addBreakpointAction)
addBreakpoint();
+ else
+ handleBaseContextAction(act);
}
void BreakWindow::setBreakpointsEnabled(const BreakpointModelIds &ids, bool enabled)
@@ -743,20 +720,6 @@ void BreakWindow::associateBreakpoint(const BreakpointModelIds &ids, int threadI
handler->setThreadSpec(id, threadId);
}
-void BreakWindow::resizeColumnsToContents()
-{
- for (int i = model()->columnCount(); --i >= 0; )
- resizeColumnToContents(i);
-}
-
-void BreakWindow::setAlwaysResizeColumnsToContents(bool on)
-{
- QHeaderView::ResizeMode mode = on
- ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
- for (int i = model()->columnCount(); --i >= 0; )
- header()->setResizeMode(i, mode);
-}
-
void BreakWindow::rowActivated(const QModelIndex &index)
{
breakHandler()->gotoLocation(breakHandler()->findBreakpointByIndex(index));
diff --git a/src/plugins/debugger/breakwindow.h b/src/plugins/debugger/breakwindow.h
index e7ce62dc24..e245d96f99 100644
--- a/src/plugins/debugger/breakwindow.h
+++ b/src/plugins/debugger/breakwindow.h
@@ -34,13 +34,12 @@
#define DEBUGGER_BREAKWINDOW_H
#include "breakpoint.h"
-
-#include <QtGui/QTreeView>
+#include "basewindow.h"
namespace Debugger {
namespace Internal {
-class BreakWindow : public QTreeView
+class BreakWindow : public BaseWindow
{
Q_OBJECT
@@ -51,15 +50,10 @@ public:
void setModel(QAbstractItemModel *model);
private slots:
- void resizeColumnsToContents();
- void setAlwaysResizeColumnsToContents(bool on);
-
- void rowActivated(const QModelIndex &index);
- void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
void showAddressColumn(bool on);
private:
- void resizeEvent(QResizeEvent *ev);
+ void rowActivated(const QModelIndex &index);
void contextMenuEvent(QContextMenuEvent *ev);
void keyPressEvent(QKeyEvent *ev);
void mouseDoubleClickEvent(QMouseEvent *ev);
diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro
index 7cbcf1f93e..40df0c389d 100644
--- a/src/plugins/debugger/debugger.pro
+++ b/src/plugins/debugger/debugger.pro
@@ -16,7 +16,9 @@ QT += gui \
network \
script
-HEADERS += breakhandler.h \
+HEADERS += \
+ basewindow.h \
+ breakhandler.h \
breakpoint.h \
breakpointmarker.h \
breakwindow.h \
@@ -67,7 +69,9 @@ HEADERS += breakhandler.h \
debuggersourcepathmappingwidget.h \
memoryview.h
-SOURCES += breakhandler.cpp \
+SOURCES += \
+ basewindow.cpp \
+ breakhandler.cpp \
breakpoint.cpp \
breakpointmarker.cpp \
breakwindow.cpp \
diff --git a/src/plugins/debugger/moduleswindow.cpp b/src/plugins/debugger/moduleswindow.cpp
index 390397f15d..900cc28e0b 100644
--- a/src/plugins/debugger/moduleswindow.cpp
+++ b/src/plugins/debugger/moduleswindow.cpp
@@ -58,23 +58,13 @@ namespace Debugger {
namespace Internal {
ModulesWindow::ModulesWindow(QWidget *parent)
- : QTreeView(parent)
+ : BaseWindow(parent)
{
- QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setWindowTitle(tr("Modules"));
- setAttribute(Qt::WA_MacShowFocusRect, false);
- setSortingEnabled(true);
- setAlternatingRowColors(act->isChecked());
- setRootIsDecorated(false);
- setIconSize(QSize(10, 10));
+ setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustModulesColumnWidths));
connect(this, SIGNAL(activated(QModelIndex)),
SLOT(moduleActivated(QModelIndex)));
- connect(act, SIGNAL(toggled(bool)),
- SLOT(setAlternatingRowColorsHelper(bool)));
- connect(debuggerCore()->action(AlwaysAdjustModulesColumnWidths),
- SIGNAL(toggled(bool)),
- SLOT(setAlwaysResizeColumnsToContents(bool)));
}
void ModulesWindow::moduleActivated(const QModelIndex &index)
@@ -163,19 +153,12 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(actLoadSymbolsForModule);
menu.addAction(actEditFile);
menu.addAction(actShowModuleSymbols);
- menu.addSeparator();
- QAction *actAdjustColumnWidths =
- menu.addAction(tr("Adjust Column Widths to Contents"));
- menu.addAction(debuggerCore()->action(AlwaysAdjustModulesColumnWidths));
- menu.addSeparator();
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ addBaseContextActions(&menu);
QAction *act = menu.exec(ev->globalPos());
if (act == actUpdateModuleList)
engine->reloadModules();
- else if (act == actAdjustColumnWidths)
- resizeColumnsToContents();
else if (act == actShowModuleSources)
engine->loadSymbols(name);
else if (act == actLoadSymbolsForAllModules)
@@ -190,35 +173,8 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
engine->requestModuleSymbols(name);
else if (actShowDependencies && act == actShowDependencies)
QProcess::startDetached(QLatin1String("depends"), QStringList(fileName));
-}
-
-void ModulesWindow::resizeColumnsToContents()
-{
- resizeColumnToContents(0);
- resizeColumnToContents(1);
- resizeColumnToContents(2);
- resizeColumnToContents(3);
-}
-
-void ModulesWindow::setAlwaysResizeColumnsToContents(bool on)
-{
- QHeaderView::ResizeMode mode = on
- ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
- header()->setResizeMode(0, mode);
- header()->setResizeMode(1, mode);
- header()->setResizeMode(2, mode);
- header()->setResizeMode(3, mode);
- header()->setResizeMode(4, mode);
- //setColumnHidden(3, true);
-}
-
-void ModulesWindow::setModel(QAbstractItemModel *model)
-{
- QTreeView::setModel(model);
- if (header()) {
- bool adjust = debuggerCore()->boolSetting(AlwaysAdjustModulesColumnWidths);
- setAlwaysResizeColumnsToContents(adjust);
- }
+ else
+ handleBaseContextAction(act);
}
} // namespace Internal
diff --git a/src/plugins/debugger/moduleswindow.h b/src/plugins/debugger/moduleswindow.h
index 010a29c54d..0c622ee4d5 100644
--- a/src/plugins/debugger/moduleswindow.h
+++ b/src/plugins/debugger/moduleswindow.h
@@ -33,12 +33,12 @@
#ifndef DEBUGGER_MODULESWINDOW_H
#define DEBUGGER_MODULESWINDOW_H
-#include <QtGui/QTreeView>
+#include "basewindow.h"
namespace Debugger {
namespace Internal {
-class ModulesWindow : public QTreeView
+class ModulesWindow : public BaseWindow
{
Q_OBJECT
@@ -46,14 +46,10 @@ public:
explicit ModulesWindow(QWidget *parent = 0);
private slots:
- void resizeColumnsToContents();
- void setAlwaysResizeColumnsToContents(bool on);
void moduleActivated(const QModelIndex &index);
- void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
private:
void contextMenuEvent(QContextMenuEvent *ev);
- void setModel(QAbstractItemModel *model);
};
} // namespace Internal
diff --git a/src/plugins/debugger/registerwindow.cpp b/src/plugins/debugger/registerwindow.cpp
index 04b06705ff..d3a1fbfd14 100644
--- a/src/plugins/debugger/registerwindow.cpp
+++ b/src/plugins/debugger/registerwindow.cpp
@@ -164,21 +164,11 @@ public:
///////////////////////////////////////////////////////////////////////
RegisterWindow::RegisterWindow(QWidget *parent)
- : QTreeView(parent)
+ : BaseWindow(parent)
{
- QAction *act = debuggerCore()->action(UseAlternatingRowColors);
- setFrameStyle(QFrame::NoFrame);
setWindowTitle(tr("Registers"));
- setAttribute(Qt::WA_MacShowFocusRect, false);
- setAlternatingRowColors(act->isChecked());
- setRootIsDecorated(false);
+ setAlwaysAdjustColumnsAction(debuggerCore()->action(UseAlternatingRowColors));
setItemDelegate(new RegisterDelegate(this));
-
- connect(act, SIGNAL(toggled(bool)),
- SLOT(setAlternatingRowColorsHelper(bool)));
- connect(debuggerCore()->action(AlwaysAdjustRegistersColumnWidths),
- SIGNAL(toggled(bool)),
- SLOT(setAlwaysResizeColumnsToContents(bool)));
setObjectName(QLatin1String("RegisterWindow"));
}
@@ -245,20 +235,13 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *act2 = menu.addAction(tr("Binary"));
act2->setCheckable(true);
act2->setChecked(base == 2);
- menu.addSeparator();
-
- QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
- menu.addAction(debuggerCore()->action(AlwaysAdjustRegistersColumnWidths));
- menu.addSeparator();
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ addBaseContextActions(&menu);
const QPoint position = ev->globalPos();
QAction *act = menu.exec(position);
- if (act == actAdjust)
- resizeColumnsToContents();
- else if (act == actReload)
+ if (act == actReload)
engine->reloadRegisters();
else if (act == actEditMemory) {
const QString registerName = QString::fromAscii(aRegister.name, address);
@@ -285,29 +268,8 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
handler->setNumberBase(8);
else if (act == act2)
handler->setNumberBase(2);
-}
-
-void RegisterWindow::resizeColumnsToContents()
-{
- resizeColumnToContents(0);
- resizeColumnToContents(1);
-}
-
-void RegisterWindow::setAlwaysResizeColumnsToContents(bool on)
-{
- QHeaderView::ResizeMode mode = on
- ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
- header()->setResizeMode(0, mode);
- header()->setResizeMode(1, mode);
-}
-
-void RegisterWindow::setModel(QAbstractItemModel *model)
-{
- QTreeView::setModel(model);
- if (header()) {
- bool adjust = debuggerCore()->boolSetting(AlwaysAdjustRegistersColumnWidths);
- setAlwaysResizeColumnsToContents(adjust);
- }
+ else
+ handleBaseContextAction(act);
}
void RegisterWindow::reloadRegisters()
diff --git a/src/plugins/debugger/registerwindow.h b/src/plugins/debugger/registerwindow.h
index 2e32325b26..d3276c0500 100644
--- a/src/plugins/debugger/registerwindow.h
+++ b/src/plugins/debugger/registerwindow.h
@@ -33,27 +33,23 @@
#ifndef DEBUGGER_REGISTERWINDOW_H
#define DEBUGGER_REGISTERWINDOW_H
-#include <QtGui/QTreeView>
+#include "basewindow.h"
namespace Debugger {
namespace Internal {
-class RegisterWindow : public QTreeView
+class RegisterWindow : public BaseWindow
{
Q_OBJECT
public:
explicit RegisterWindow(QWidget *parent = 0);
- void setModel(QAbstractItemModel *model);
public slots:
- void resizeColumnsToContents();
- void setAlwaysResizeColumnsToContents(bool on);
- void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
void reloadRegisters();
private:
- virtual void contextMenuEvent(QContextMenuEvent *ev);
+ void contextMenuEvent(QContextMenuEvent *ev);
};
} // namespace Internal
diff --git a/src/plugins/debugger/snapshotwindow.cpp b/src/plugins/debugger/snapshotwindow.cpp
index 6f1429611d..973fcf6f8b 100644
--- a/src/plugins/debugger/snapshotwindow.cpp
+++ b/src/plugins/debugger/snapshotwindow.cpp
@@ -59,24 +59,8 @@ namespace Internal {
SnapshotWindow::SnapshotWindow(SnapshotHandler *handler)
{
m_snapshotHandler = handler;
-
- QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setWindowTitle(tr("Snapshots"));
- setAttribute(Qt::WA_MacShowFocusRect, false);
- setFrameStyle(QFrame::NoFrame);
- setAlternatingRowColors(act->isChecked());
- setRootIsDecorated(false);
- setIconSize(QSize(10, 10));
-
- header()->setDefaultAlignment(Qt::AlignLeft);
-
- connect(this, SIGNAL(activated(QModelIndex)),
- SLOT(rowActivated(QModelIndex)));
- connect(act, SIGNAL(toggled(bool)),
- SLOT(setAlternatingRowColorsHelper(bool)));
- connect(debuggerCore()->action(AlwaysAdjustSnapshotsColumnWidths),
- SIGNAL(toggled(bool)),
- SLOT(setAlwaysResizeColumnsToContents(bool)));
+ setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustSnapshotsColumnWidths));
}
void SnapshotWindow::rowActivated(const QModelIndex &index)
@@ -112,13 +96,8 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *actRemove = menu.addAction(tr("Remove Snapshot"));
actRemove->setEnabled(idx.isValid());
- menu.addSeparator();
-
- QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
- menu.addAction(debuggerCore()->action(AlwaysAdjustSnapshotsColumnWidths));
- menu.addSeparator();
-
- menu.addAction(debuggerCore()->action(SettingsDialog));
+
+ addBaseContextActions(&menu);
QAction *act = menu.exec(ev->globalPos());
@@ -126,8 +105,8 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
m_snapshotHandler->createSnapshot(idx.row());
else if (act == actRemove)
removeSnapshot(idx.row());
- else if (act == actAdjust)
- resizeColumnsToContents();
+ else
+ handleBaseContextAction(act);
}
void SnapshotWindow::removeSnapshot(int i)
@@ -135,29 +114,5 @@ void SnapshotWindow::removeSnapshot(int i)
m_snapshotHandler->at(i)->quitDebugger();
}
-void SnapshotWindow::setModel(QAbstractItemModel *model)
-{
- QTreeView::setModel(model);
- setAlwaysResizeColumnsToContents(true);
- if (header()) {
- bool adjust = debuggerCore()->boolSetting(AlwaysAdjustSnapshotsColumnWidths);
- setAlwaysResizeColumnsToContents(adjust);
- }
-}
-
-void SnapshotWindow::resizeColumnsToContents()
-{
- for (int i = model()->columnCount(); --i >= 0; )
- resizeColumnToContents(i);
-}
-
-void SnapshotWindow::setAlwaysResizeColumnsToContents(bool on)
-{
- QHeaderView::ResizeMode mode =
- on ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
- for (int i = model()->columnCount(); --i >= 0; )
- header()->setResizeMode(i, mode);
-}
-
} // namespace Internal
} // namespace Debugger
diff --git a/src/plugins/debugger/snapshotwindow.h b/src/plugins/debugger/snapshotwindow.h
index f9b2a39959..d8e4e380e3 100644
--- a/src/plugins/debugger/snapshotwindow.h
+++ b/src/plugins/debugger/snapshotwindow.h
@@ -33,33 +33,25 @@
#ifndef DEBUGGER_SNAPSHOTWINDOW_H
#define DEBUGGER_SNAPSHOTWINDOW_H
-#include <QtGui/QTreeView>
+#include "basewindow.h"
namespace Debugger {
namespace Internal {
class SnapshotHandler;
-class SnapshotWindow : public QTreeView
+class SnapshotWindow : public BaseWindow
{
Q_OBJECT
public:
explicit SnapshotWindow(SnapshotHandler *handler);
-public slots:
- void resizeColumnsToContents();
- void setAlwaysResizeColumnsToContents(bool on);
-
-private slots:
- void rowActivated(const QModelIndex &index);
- void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
-
private:
+ void rowActivated(const QModelIndex &index);
void removeSnapshot(int i);
void keyPressEvent(QKeyEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev);
- void setModel(QAbstractItemModel *model);
SnapshotHandler *m_snapshotHandler;
};
diff --git a/src/plugins/debugger/sourcefileswindow.cpp b/src/plugins/debugger/sourcefileswindow.cpp
index b81266c6c6..ffbc5abf69 100644
--- a/src/plugins/debugger/sourcefileswindow.cpp
+++ b/src/plugins/debugger/sourcefileswindow.cpp
@@ -43,9 +43,8 @@
#include <QtCore/QDebug>
#include <QtCore/QFileInfo>
-#include <QtGui/QHeaderView>
+#include <QtGui/QContextMenuEvent>
#include <QtGui/QMenu>
-#include <QtGui/QResizeEvent>
//////////////////////////////////////////////////////////////////
@@ -57,41 +56,22 @@
namespace Debugger {
namespace Internal {
-static DebuggerEngine *currentEngine()
-{
- return debuggerCore()->currentEngine();
-}
-
SourceFilesWindow::SourceFilesWindow(QWidget *parent)
- : QTreeView(parent)
+ : BaseWindow(parent)
{
- QAction *act = debuggerCore()->action(UseAlternatingRowColors);
-
- setAttribute(Qt::WA_MacShowFocusRect, false);
- setFrameStyle(QFrame::NoFrame);
setWindowTitle(tr("Source Files"));
- setSortingEnabled(true);
- setAlternatingRowColors(act->isChecked());
- setRootIsDecorated(false);
- setIconSize(QSize(10, 10));
- //header()->setDefaultAlignment(Qt::AlignLeft);
-
- connect(this, SIGNAL(activated(QModelIndex)),
- SLOT(sourceFileActivated(QModelIndex)));
- connect(act, SIGNAL(toggled(bool)),
- SLOT(setAlternatingRowColorsHelper(bool)));
}
-void SourceFilesWindow::sourceFileActivated(const QModelIndex &index)
+void SourceFilesWindow::rowActivated(const QModelIndex &index)
{
- DebuggerEngine *engine = currentEngine();
+ DebuggerEngine *engine = debuggerCore()->currentEngine();
QTC_ASSERT(engine, return);
engine->gotoLocation(index.data().toString());
}
void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
{
- DebuggerEngine *engine = currentEngine();
+ DebuggerEngine *engine = debuggerCore()->currentEngine();
QTC_ASSERT(engine, return);
QModelIndex index = indexAt(ev->pos());
index = index.sibling(index.row(), 0);
@@ -114,8 +94,7 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(act1);
menu.addAction(act2);
- menu.addSeparator();
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ addBaseContextActions(&menu);
QAction *act = menu.exec(ev->globalPos());
@@ -123,6 +102,8 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
engine->reloadSourceFiles();
else if (act == act2)
engine->gotoLocation(name);
+ else
+ handleBaseContextAction(act);
}
} // namespace Internal
diff --git a/src/plugins/debugger/sourcefileswindow.h b/src/plugins/debugger/sourcefileswindow.h
index a1b3f89956..a54f5a005f 100644
--- a/src/plugins/debugger/sourcefileswindow.h
+++ b/src/plugins/debugger/sourcefileswindow.h
@@ -33,23 +33,20 @@
#ifndef DEBUGGER_SOURCEFILEWINDOW_H
#define DEBUGGER_SOURCEFILEWINDOW_H
-#include <QtGui/QTreeView>
+#include "basewindow.h"
namespace Debugger {
namespace Internal {
-class SourceFilesWindow : public QTreeView
+class SourceFilesWindow : public BaseWindow
{
Q_OBJECT
public:
SourceFilesWindow(QWidget *parent = 0);
-private slots:
- void sourceFileActivated(const QModelIndex &index);
- void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
-
private:
+ void rowActivated(const QModelIndex &index);
void contextMenuEvent(QContextMenuEvent *ev);
};
diff --git a/src/plugins/debugger/stackwindow.cpp b/src/plugins/debugger/stackwindow.cpp
index ef51bf71e5..8191459041 100644
--- a/src/plugins/debugger/stackwindow.cpp
+++ b/src/plugins/debugger/stackwindow.cpp
@@ -46,9 +46,9 @@
#include <QtGui/QApplication>
#include <QtGui/QClipboard>
+#include <QtGui/QContextMenuEvent>
#include <QtGui/QHeaderView>
#include <QtGui/QMenu>
-#include <QtGui/QResizeEvent>
namespace Debugger {
namespace Internal {
@@ -59,33 +59,17 @@ static DebuggerEngine *currentEngine()
}
StackWindow::StackWindow(QWidget *parent)
- : QTreeView(parent)
+ : BaseWindow(parent)
{
- setAttribute(Qt::WA_MacShowFocusRect, false);
- setFrameStyle(QFrame::NoFrame);
-
- QAction *act = debuggerCore()->action(UseAlternatingRowColors);
setWindowTitle(tr("Stack"));
+ setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustStackColumnWidths));
- setAlternatingRowColors(act->isChecked());
- setRootIsDecorated(false);
- setIconSize(QSize(10, 10));
-
- header()->setDefaultAlignment(Qt::AlignLeft);
-
- connect(this, SIGNAL(activated(QModelIndex)),
- SLOT(rowActivated(QModelIndex)));
- connect(act, SIGNAL(toggled(bool)),
- SLOT(setAlternatingRowColorsHelper(bool)));
connect(debuggerCore()->action(UseAddressInStackView), SIGNAL(toggled(bool)),
SLOT(showAddressColumn(bool)));
connect(debuggerCore()->action(ExpandStack), SIGNAL(triggered()),
SLOT(reloadFullStack()));
connect(debuggerCore()->action(MaximalStackDepth), SIGNAL(triggered()),
SLOT(reloadFullStack()));
- connect(debuggerCore()->action(AlwaysAdjustStackColumnWidths),
- SIGNAL(triggered(bool)),
- SLOT(setAlwaysResizeColumnsToContents(bool)));
showAddressColumn(false);
}
@@ -101,14 +85,9 @@ void StackWindow::rowActivated(const QModelIndex &index)
void StackWindow::setModel(QAbstractItemModel *model)
{
- QTreeView::setModel(model);
- //resizeColumnsToContents();
+ BaseWindow::setModel(model);
resizeColumnToContents(0);
resizeColumnToContents(3);
- if (header()) {
- bool adjust = debuggerCore()->boolSetting(AlwaysAdjustStackColumnWidths);
- setAlwaysResizeColumnsToContents(adjust);
- }
}
void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
@@ -162,20 +141,12 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
#endif
menu.addAction(debuggerCore()->action(UseAddressInStackView));
- QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
- menu.addAction(debuggerCore()->action(AlwaysAdjustStackColumnWidths));
- menu.addSeparator();
-
- menu.addAction(debuggerCore()->action(SettingsDialog));
+ addBaseContextActions(&menu);
QAction *act = menu.exec(ev->globalPos());
- if (!act)
- ;
- else if (act == actCopyContents)
+ if (act == actCopyContents)
copyContentsToClipboard();
- else if (act == actAdjust)
- resizeColumnsToContents();
else if (act == actShowMemory) {
const QString title = tr("Memory at Frame #%1 (%2) 0x%3").
arg(row).arg(frame.function).arg(address, 0, 16);
@@ -193,6 +164,8 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
engine->openDisassemblerView(frame);
else if (act == actLoadSymbols)
engine->loadSymbolsForStack();
+ else
+ handleBaseContextAction(act);
}
void StackWindow::copyContentsToClipboard()
@@ -220,19 +193,5 @@ void StackWindow::reloadFullStack()
currentEngine()->reloadFullStack();
}
-void StackWindow::resizeColumnsToContents()
-{
- for (int i = model()->columnCount(); --i >= 0; )
- resizeColumnToContents(i);
-}
-
-void StackWindow::setAlwaysResizeColumnsToContents(bool on)
-{
- QHeaderView::ResizeMode mode =
- on ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
- for (int i = model()->columnCount(); --i >= 0; )
- header()->setResizeMode(i, mode);
-}
-
} // namespace Internal
} // namespace Debugger
diff --git a/src/plugins/debugger/stackwindow.h b/src/plugins/debugger/stackwindow.h
index 49989c18b4..cd4d53268c 100644
--- a/src/plugins/debugger/stackwindow.h
+++ b/src/plugins/debugger/stackwindow.h
@@ -33,29 +33,24 @@
#ifndef DEBUGGER_STACKWINDOW_H
#define DEBUGGER_STACKWINDOW_H
-#include <QtGui/QTreeView>
+#include "basewindow.h"
namespace Debugger {
namespace Internal {
-class StackWindow : public QTreeView
+class StackWindow : public BaseWindow
{
Q_OBJECT
public:
explicit StackWindow(QWidget *parent = 0);
-public slots:
- void resizeColumnsToContents();
- void setAlwaysResizeColumnsToContents(bool on);
-
private slots:
- void rowActivated(const QModelIndex &index);
- void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
void showAddressColumn(bool on);
void reloadFullStack();
private:
+ void rowActivated(const QModelIndex &index);
void setModel(QAbstractItemModel *model);
void contextMenuEvent(QContextMenuEvent *ev);
void copyContentsToClipboard();
diff --git a/src/plugins/debugger/threadswindow.cpp b/src/plugins/debugger/threadswindow.cpp
index 643ddc9332..55924f6ea0 100644
--- a/src/plugins/debugger/threadswindow.cpp
+++ b/src/plugins/debugger/threadswindow.cpp
@@ -49,26 +49,11 @@ namespace Debugger {
namespace Internal {
ThreadsWindow::ThreadsWindow(QWidget *parent)
- : QTreeView(parent)
+ : BaseWindow(parent)
{
- QAction *act = debuggerCore()->action(UseAlternatingRowColors);
-
- setAttribute(Qt::WA_MacShowFocusRect, false);
- setFrameStyle(QFrame::NoFrame);
setWindowTitle(tr("Thread"));
- setAlternatingRowColors(act->isChecked());
- setRootIsDecorated(false);
- setIconSize(QSize(10, 10));
-
- header()->setDefaultAlignment(Qt::AlignLeft);
-
- connect(this, SIGNAL(activated(QModelIndex)),
- SLOT(rowActivated(QModelIndex)));
- connect(act, SIGNAL(toggled(bool)),
- SLOT(setAlternatingRowColorsHelper(bool)));
- connect(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths),
- SIGNAL(toggled(bool)),
- SLOT(setAlwaysResizeColumnsToContents(bool)));
+ setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths));
+ setObjectName(QLatin1String("ThreadsWindow"));
}
void ThreadsWindow::rowActivated(const QModelIndex &index)
@@ -78,48 +63,20 @@ void ThreadsWindow::rowActivated(const QModelIndex &index)
void ThreadsWindow::setModel(QAbstractItemModel *model)
{
- QTreeView::setModel(model);
+ BaseWindow::setModel(model);
resizeColumnToContents(ThreadData::IdColumn);
resizeColumnToContents(ThreadData::LineColumn);
resizeColumnToContents(ThreadData::NameColumn);
resizeColumnToContents(ThreadData::StateColumn);
resizeColumnToContents(ThreadData::TargetIdColumn);
- if (header()) {
- bool adjust = debuggerCore()->boolSetting(AlwaysAdjustThreadsColumnWidths);
- setAlwaysResizeColumnsToContents(adjust);
- }
}
void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
- QAction *adjustColumnAction =
- menu.addAction(tr("Adjust Column Widths to Contents"));
- menu.addAction(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths));
- menu.addSeparator();
-
- menu.addAction(debuggerCore()->action(SettingsDialog));
-
+ addBaseContextActions(&menu);
QAction *act = menu.exec(ev->globalPos());
- if (!act)
- return;
-
- if (act == adjustColumnAction)
- resizeColumnsToContents();
-}
-
-void ThreadsWindow::resizeColumnsToContents()
-{
- const int columnCount = model()->columnCount();
- for (int c = 0 ; c != columnCount; ++c)
- resizeColumnToContents(c);
-}
-
-void ThreadsWindow::setAlwaysResizeColumnsToContents(bool on)
-{
- QHeaderView::ResizeMode mode = on
- ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
- header()->setResizeMode(0, mode);
+ handleBaseContextAction(act);
}
} // namespace Internal
diff --git a/src/plugins/debugger/threadswindow.h b/src/plugins/debugger/threadswindow.h
index d21724d768..b1319ffd63 100644
--- a/src/plugins/debugger/threadswindow.h
+++ b/src/plugins/debugger/threadswindow.h
@@ -33,27 +33,20 @@
#ifndef DEBUGGER_THREADWINDOW_H
#define DEBUGGER_THREADWINDOW_H
-#include <QtGui/QTreeView>
+#include "basewindow.h"
namespace Debugger {
namespace Internal {
-class ThreadsWindow : public QTreeView
+class ThreadsWindow : public BaseWindow
{
Q_OBJECT
public:
ThreadsWindow(QWidget *parent = 0);
-public slots:
- void resizeColumnsToContents();
- void setAlwaysResizeColumnsToContents(bool on);
-
-private slots:
- void rowActivated(const QModelIndex &index);
- void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
-
private:
+ void rowActivated(const QModelIndex &index);
void setModel(QAbstractItemModel *model);
void contextMenuEvent(QContextMenuEvent *ev);
};
diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp
index 16b8fb5c05..7e4fea9b41 100644
--- a/src/plugins/debugger/watchwindow.cpp
+++ b/src/plugins/debugger/watchwindow.cpp
@@ -478,14 +478,11 @@ static void addStackLayoutMemoryView(DebuggerEngine *engine, bool separateView,
/////////////////////////////////////////////////////////////////////
WatchWindow::WatchWindow(Type type, QWidget *parent)
- : QTreeView(parent),
+ : BaseWindow(parent),
m_type(type)
{
setObjectName(QLatin1String("WatchWindow"));
m_grabbing = false;
-
- setFrameStyle(QFrame::NoFrame);
- setAttribute(Qt::WA_MacShowFocusRect, false);
setWindowTitle(tr("Locals and Expressions"));
setIndentation(indentation() * 9/10);
setUniformRowHeights(true);
@@ -493,16 +490,8 @@ WatchWindow::WatchWindow(Type type, QWidget *parent)
setDragEnabled(true);
setAcceptDrops(true);
setDropIndicatorShown(true);
+ setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustLocalsColumnWidths));
- QAction *useColors = debuggerCore()->action(UseAlternatingRowColors);
- setAlternatingRowColors(useColors->isChecked());
-
- QAction *adjustColumns = debuggerCore()->action(AlwaysAdjustLocalsColumnWidths);
-
- connect(useColors, SIGNAL(toggled(bool)),
- SLOT(setAlternatingRowColorsHelper(bool)));
- connect(adjustColumns, SIGNAL(triggered(bool)),
- SLOT(setAlwaysResizeColumnsToContents(bool)));
connect(this, SIGNAL(expanded(QModelIndex)),
SLOT(expandNode(QModelIndex)));
connect(this, SIGNAL(collapsed(QModelIndex)),
@@ -864,11 +853,6 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
menu.addAction(debuggerCore()->action(ShowQtNamespace));
menu.addAction(debuggerCore()->action(SortStructMembers));
- QAction *actAdjustColumnWidths =
- menu.addAction(tr("Adjust Column Widths to Contents"));
- menu.addAction(debuggerCore()->action(AlwaysAdjustLocalsColumnWidths));
- menu.addSeparator();
-
QAction *actClearCodeModelSnapshot
= new QAction(tr("Refresh Code Model Snapshot"), &menu);
actClearCodeModelSnapshot->setEnabled(actionsEnabled
@@ -885,20 +869,17 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
actCloseEditorToolTips->setEnabled(DebuggerToolTipManager::instance()->hasToolTips());
menu.addAction(actCloseEditorToolTips);
+ addBaseContextActions(&menu);
+
QAction *act = menu.exec(ev->globalPos());
- if (act == 0)
- return;
- if (act == actAdjustColumnWidths) {
- resizeColumnsToContents();
- } else if (act == actInsertNewWatchItem) {
+ if (act == actInsertNewWatchItem) {
bool ok;
QString newExp = QInputDialog::getText(this, tr("Enter watch expression"),
tr("Expression:"), QLineEdit::Normal,
QString(), &ok);
- if (ok && !newExp.isEmpty()) {
+ if (ok && !newExp.isEmpty())
watchExpression(newExp);
- }
} else if (act == actOpenMemoryEditAtVariableAddress) {
addVariableMemoryView(currentEngine(), false, mi0, false, ev->globalPos(), this);
} else if (act == actOpenMemoryEditAtPointerValue) {
@@ -953,6 +934,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
handler->setUnprintableBase(16);
} else if (act == actCloseEditorToolTips) {
DebuggerToolTipManager::instance()->closeAllToolTips();
+ } else if (handleBaseContextAction(act)) {
+ ;
} else {
for (int i = 0; i != typeFormatActions.size(); ++i) {
if (act == typeFormatActions.at(i))
@@ -965,22 +948,6 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
}
}
-void WatchWindow::resizeColumnsToContents()
-{
- resizeColumnToContents(0);
- resizeColumnToContents(1);
-}
-
-void WatchWindow::setAlwaysResizeColumnsToContents(bool on)
-{
- if (!header())
- return;
- QHeaderView::ResizeMode mode = on
- ? QHeaderView::ResizeToContents : QHeaderView::Interactive;
- header()->setResizeMode(0, mode);
- header()->setResizeMode(1, mode);
-}
-
bool WatchWindow::event(QEvent *ev)
{
if (m_grabbing && ev->type() == QEvent::MouseButtonPress) {
@@ -999,12 +966,9 @@ void WatchWindow::editItem(const QModelIndex &idx)
void WatchWindow::setModel(QAbstractItemModel *model)
{
- QTreeView::setModel(model);
-
+ BaseWindow::setModel(model);
setRootIsDecorated(true);
if (header()) {
- setAlwaysResizeColumnsToContents(
- debuggerCore()->boolSetting(AlwaysAdjustLocalsColumnWidths));
header()->setDefaultAlignment(Qt::AlignLeft);
if (m_type != LocalsType)
header()->hide();
diff --git a/src/plugins/debugger/watchwindow.h b/src/plugins/debugger/watchwindow.h
index 3e97372547..8edb083a0e 100644
--- a/src/plugins/debugger/watchwindow.h
+++ b/src/plugins/debugger/watchwindow.h
@@ -33,7 +33,7 @@
#ifndef DEBUGGER_WATCHWINDOW_H
#define DEBUGGER_WATCHWINDOW_H
-#include <QtGui/QTreeView>
+#include "basewindow.h"
namespace Debugger {
namespace Internal {
@@ -44,7 +44,7 @@ namespace Internal {
//
/////////////////////////////////////////////////////////////////////
-class WatchWindow : public QTreeView
+class WatchWindow : public BaseWindow
{
Q_OBJECT
@@ -55,9 +55,6 @@ public:
Type type() const { return m_type; }
public slots:
- void resizeColumnsToContents();
- void setModel(QAbstractItemModel *model);
- void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
void watchExpression(const QString &exp);
void removeWatchExpression(const QString &exp);
@@ -66,8 +63,8 @@ private:
Q_SLOT void expandNode(const QModelIndex &idx);
Q_SLOT void collapseNode(const QModelIndex &idx);
Q_SLOT void setUpdatesEnabled(bool enable);
- Q_SLOT void setAlwaysResizeColumnsToContents(bool on);
+ void setModel(QAbstractItemModel *model);
void keyPressEvent(QKeyEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev);
void dragEnterEvent(QDragEnterEvent *ev);