diff options
author | hjk <qtc-committer@nokia.com> | 2009-10-01 11:22:44 +0200 |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2009-10-01 11:42:04 +0200 |
commit | ccd37a6655ed1d840a553902120cdcf3e2119518 (patch) | |
tree | 860615fade6d7a8868e84704a82e27dc3b2b1daf | |
parent | d9d39ab218a51dc036f842e2a93bf4ade68924c8 (diff) | |
download | qt-creator-ccd37a6655ed1d840a553902120cdcf3e2119518.tar.gz |
debugger: make 'address column' in stack and breakpoint view optional
-rw-r--r-- | src/plugins/debugger/breakhandler.cpp | 16 | ||||
-rw-r--r-- | src/plugins/debugger/breakhandler.h | 7 | ||||
-rw-r--r-- | src/plugins/debugger/breakwindow.cpp | 21 | ||||
-rw-r--r-- | src/plugins/debugger/breakwindow.h | 1 | ||||
-rw-r--r-- | src/plugins/debugger/commonoptionspage.ui | 20 | ||||
-rw-r--r-- | src/plugins/debugger/debuggeractions.cpp | 34 | ||||
-rw-r--r-- | src/plugins/debugger/debuggeractions.h | 9 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 9 | ||||
-rw-r--r-- | src/plugins/debugger/stackhandler.h | 4 | ||||
-rw-r--r-- | src/plugins/debugger/stackwindow.cpp | 32 | ||||
-rw-r--r-- | src/plugins/debugger/stackwindow.h | 2 | ||||
-rw-r--r-- | src/plugins/debugger/watchwindow.cpp | 1 | ||||
-rw-r--r-- | src/plugins/qmleditor/parser/qmljsastvisitor.cpp | 4 |
13 files changed, 88 insertions, 72 deletions
diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp index a24f53f8e7..e0b397fcef 100644 --- a/src/plugins/debugger/breakhandler.cpp +++ b/src/plugins/debugger/breakhandler.cpp @@ -257,9 +257,8 @@ bool BreakpointData::conditionsMatch() const ////////////////////////////////////////////////////////////////// BreakHandler::BreakHandler(DebuggerManager *manager, QObject *parent) - : QAbstractItemModel(parent), m_manager(manager) -{ -} + : QAbstractTableModel(parent), m_manager(manager) +{} BreakHandler::~BreakHandler() { @@ -268,7 +267,7 @@ BreakHandler::~BreakHandler() int BreakHandler::columnCount(const QModelIndex &parent) const { - return parent.isValid() ? 0 : 6; + return parent.isValid() ? 0 : 7; } int BreakHandler::rowCount(const QModelIndex &parent) const @@ -436,7 +435,7 @@ QVariant BreakHandler::headerData(int section, if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { static QString headers[] = { tr("Number"), tr("Function"), tr("File"), tr("Line"), - tr("Condition"), tr("Ignore") + tr("Condition"), tr("Ignore"), tr("Address") }; return headers[section]; } @@ -505,10 +504,13 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const return data->pending ? data->ignoreCount : data->bpIgnoreCount; if (role == Qt::ToolTipRole) return tr("Breakpoint will only be hit after being ignored so many times."); + case 6: + if (role == Qt::DisplayRole) + return data->bpAddress; break; } if (role == Qt::ToolTipRole) - return theDebuggerBoolSetting(UseToolTipsInLocalsView) + return theDebuggerBoolSetting(UseToolTipsInBreakpointsView) ? data->toToolTip() : QVariant(); return QVariant(); } @@ -519,7 +521,7 @@ Qt::ItemFlags BreakHandler::flags(const QModelIndex &mi) const //case 0: // return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled; default: - return QAbstractItemModel::flags(mi); + return QAbstractTableModel::flags(mi); } } diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h index 0e5fbbbfb1..75058ffc64 100644 --- a/src/plugins/debugger/breakhandler.h +++ b/src/plugins/debugger/breakhandler.h @@ -33,7 +33,7 @@ #include <utils/qtcassert.h> #include <QtCore/QObject> -#include <QtCore/QAbstractItemModel> +#include <QtCore/QAbstractTableModel> namespace Debugger { class DebuggerManager; @@ -109,7 +109,7 @@ public: // ////////////////////////////////////////////////////////////////// -class BreakHandler : public QAbstractItemModel +class BreakHandler : public QAbstractTableModel { Q_OBJECT @@ -158,9 +158,6 @@ private: int rowCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; bool setData(const QModelIndex &index, const QVariant &, int role); - QModelIndex parent(const QModelIndex &) const { return QModelIndex(); } - QModelIndex index(int row, int column, const QModelIndex &) const - { return createIndex(row, column); } QVariant headerData(int section, Qt::Orientation orientation, int role) const; Qt::ItemFlags flags(const QModelIndex &index) const; diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index d26e6ed01f..46dc6faac7 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -93,6 +93,13 @@ BreakWindow::BreakWindow(QWidget *parent) this, SLOT(rowActivated(QModelIndex))); connect(act, SIGNAL(toggled(bool)), this, SLOT(setAlternatingRowColorsHelper(bool))); + connect(theDebuggerAction(UseAddressInBreakpointsView), SIGNAL(toggled(bool)), + this, SLOT(showAddressColumn(bool))); +} + +void BreakWindow::showAddressColumn(bool on) +{ + setColumnHidden(6, !on); } static QModelIndexList normalizeIndexes(const QModelIndexList &list) @@ -201,6 +208,8 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(breakAtFunctionAction); menu.addAction(breakAtMainAction); menu.addSeparator(); + menu.addAction(theDebuggerAction(UseToolTipsInBreakpointsView)); + menu.addAction(theDebuggerAction(UseAddressInBreakpointsView)); menu.addAction(adjustColumnAction); menu.addAction(alwaysAdjustAction); menu.addSeparator(); @@ -300,10 +309,8 @@ void BreakWindow::editConditions(const QModelIndexList &list) void BreakWindow::resizeColumnsToContents() { - resizeColumnToContents(0); - resizeColumnToContents(1); - resizeColumnToContents(2); - resizeColumnToContents(3); + for (int i = model()->columnCount(); --i >= 0; ) + resizeColumnToContents(i); } void BreakWindow::setAlwaysResizeColumnsToContents(bool on) @@ -311,10 +318,8 @@ void BreakWindow::setAlwaysResizeColumnsToContents(bool on) m_alwaysResizeColumnsToContents = 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); + for (int i = model()->columnCount(); --i >= 0; ) + header()->setResizeMode(i, mode); } void BreakWindow::rowActivated(const QModelIndex &idx) diff --git a/src/plugins/debugger/breakwindow.h b/src/plugins/debugger/breakwindow.h index 7518b9af4a..18a39ba7ba 100644 --- a/src/plugins/debugger/breakwindow.h +++ b/src/plugins/debugger/breakwindow.h @@ -56,6 +56,7 @@ signals: private slots: void rowActivated(const QModelIndex &index); void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); } + void showAddressColumn(bool on); protected: void resizeEvent(QResizeEvent *ev); diff --git a/src/plugins/debugger/commonoptionspage.ui b/src/plugins/debugger/commonoptionspage.ui index 2455158059..04176b57dc 100644 --- a/src/plugins/debugger/commonoptionspage.ui +++ b/src/plugins/debugger/commonoptionspage.ui @@ -53,26 +53,6 @@ </widget> </item> <item> - <widget class="QCheckBox" name="checkBoxUseToolTipsInMainEditor"> - <property name="toolTip"> - <string>Checking this will enable tooltips for variable values during debugging. Since this can slow down debugging and does not provide reliable information as it does not use scope information, it is switched off by default.</string> - </property> - <property name="text"> - <string>Use tooltips in locals view while debugging</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkBoxUseToolTipsInLocalsView"> - <property name="toolTip"> - <string>Checking this will enable tooltips for in the locals view during debugging.</string> - </property> - <property name="text"> - <string>Use tooltips in main editor while debugging</string> - </property> - </widget> - </item> - <item> <widget class="QCheckBox" name="checkBoxEnableReverseDebugging"> <property name="text"> <string>Enable reverse debugging</string> diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 5113a494c4..6ef805bd96 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -259,6 +259,10 @@ DebuggerSettings *DebuggerSettings::instance() item = new SavedAction(instance); item->setSettingsKey(debugModeGroup, QLatin1String("UseToolTips")); item->setText(tr("Use tooltips in main editor when debugging")); + item->setToolTip(tr("Checking this will enable tooltips for variable " + "values during debugging. Since this can slow down debugging and " + "does not provide reliable information as it does not use scope " + "information, it is switched off by default.")); item->setCheckable(true); item->setDefaultValue(false); instance->insertItem(UseToolTipsInMainEditor, item); @@ -266,11 +270,41 @@ DebuggerSettings *DebuggerSettings::instance() item = new SavedAction(instance); item->setSettingsKey(debugModeGroup, QLatin1String("UseToolTipsInLocalsView")); item->setText(tr("Use tooltips in locals view when debugging")); + item->setToolTip(tr("Checking this will enable tooltips in the locals " + "view during debugging.")); item->setCheckable(true); item->setDefaultValue(false); instance->insertItem(UseToolTipsInLocalsView, item); item = new SavedAction(instance); + item->setSettingsKey(debugModeGroup, QLatin1String("UseToolTipsInBreakpointsView")); + item->setText(tr("Use tooltips in breakpoints view when debugging")); + item->setToolTip(tr("Checking this will enable tooltips in the breakpoints " + "view during debugging.")); + item->setCheckable(true); + item->setDefaultValue(false); + instance->insertItem(UseToolTipsInBreakpointsView, item); + + item = new SavedAction(instance); + item->setSettingsKey(debugModeGroup, QLatin1String("UseAddressInBreakpointsView")); + item->setText(tr("Show address data in breakpoints view when debugging")); + item->setToolTip(tr("Checking this will show a column with address " + "information in the breakpoint view during debugging.")); + item->setCheckable(true); + item->setDefaultValue(false); + instance->insertItem(UseAddressInBreakpointsView, item); + item = new SavedAction(instance); + + item = new SavedAction(instance); + item->setSettingsKey(debugModeGroup, QLatin1String("UseAddressInStackView")); + item->setText(tr("Show address data in stack view when debugging")); + item->setToolTip(tr("Checking this will show a column with address " + "information in the stack view during debugging.")); + item->setCheckable(true); + item->setDefaultValue(false); + instance->insertItem(UseAddressInStackView, item); + item = new SavedAction(instance); + item->setSettingsKey(debugModeGroup, QLatin1String("ListSourceFiles")); item->setText(tr("List source files")); item->setCheckable(true); diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index 0109baf74b..d8c1966abd 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -85,6 +85,13 @@ enum DebuggerActionCode CustomDebuggingHelperLocation, DebugDebuggingHelpers, + UseToolTipsInMainEditor, + UseToolTipsInLocalsView, + UseToolTipsInBreakpointsView, + UseToolTipsInStackView, + UseAddressInBreakpointsView, + UseAddressInStackView, + // Gdb GdbLocation, GdbEnvironment, @@ -100,8 +107,6 @@ enum DebuggerActionCode WatchExpressionInWindow, RemoveWatchExpression, WatchPoint, - UseToolTipsInMainEditor, - UseToolTipsInLocalsView, AssignValue, AssignType, diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 421eaeea4d..d7e024b02e 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -292,10 +292,11 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent) m_ui.checkBoxUseMessageBoxForSignals); m_group.insert(theDebuggerAction(SkipKnownFrames), m_ui.checkBoxSkipKnownFrames); - m_group.insert(theDebuggerAction(UseToolTipsInMainEditor), - m_ui.checkBoxUseToolTipsInMainEditor); - m_group.insert(theDebuggerAction(UseToolTipsInLocalsView), - m_ui.checkBoxUseToolTipsInLocalsView); + m_group.insert(theDebuggerAction(UseToolTipsInMainEditor), 0); + m_group.insert(theDebuggerAction(UseToolTipsInLocalsView), 0); + m_group.insert(theDebuggerAction(UseToolTipsInBreakpointsView), 0); + m_group.insert(theDebuggerAction(UseAddressInBreakpointsView), 0); + m_group.insert(theDebuggerAction(UseAddressInStackView), 0); m_group.insert(theDebuggerAction(EnableReverseDebugging), m_ui.checkBoxEnableReverseDebugging); m_group.insert(theDebuggerAction(MaximalStackDepth), diff --git a/src/plugins/debugger/stackhandler.h b/src/plugins/debugger/stackhandler.h index 3fee2a5f87..7db40a263b 100644 --- a/src/plugins/debugger/stackhandler.h +++ b/src/plugins/debugger/stackhandler.h @@ -32,7 +32,7 @@ #include "stackframe.h" -#include <QtCore/QAbstractTableModel> +#include <QtCore/QAbstractItemModel> #include <QtCore/QObject> #include <QtGui/QIcon> @@ -72,7 +72,7 @@ private: int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + QVariant headerData(int section, Qt::Orientation orientation, int role) const; Qt::ItemFlags flags(const QModelIndex &index) const; QList<StackFrame> m_stackFrames; diff --git a/src/plugins/debugger/stackwindow.cpp b/src/plugins/debugger/stackwindow.cpp index 5450e20f5d..9b94856dea 100644 --- a/src/plugins/debugger/stackwindow.cpp +++ b/src/plugins/debugger/stackwindow.cpp @@ -69,22 +69,13 @@ StackWindow::StackWindow(DebuggerManager *manager, QWidget *parent) this, SLOT(rowActivated(QModelIndex))); connect(act, SIGNAL(toggled(bool)), this, SLOT(setAlternatingRowColorsHelper(bool))); + connect(theDebuggerAction(UseAddressInStackView), SIGNAL(toggled(bool)), + this, SLOT(showAddressColumn(bool))); } -void StackWindow::resizeEvent(QResizeEvent *event) +void StackWindow::showAddressColumn(bool on) { -/* - QHeaderView *hv = header(); - - int totalSize = event->size().width() - 120; - if (totalSize > 10) { - hv->resizeSection(0, 45); - hv->resizeSection(1, totalSize / 2); - hv->resizeSection(2, totalSize / 2); - hv->resizeSection(3, 55); - } -*/ - QTreeView::resizeEvent(event); + setColumnHidden(4, !on); } void StackWindow::rowActivated(const QModelIndex &index) @@ -124,6 +115,9 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addSeparator(); + //menu.addAction(theDebuggerAction(UseTooltipsInStackView)); + menu.addAction(theDebuggerAction(UseAddressInStackView)); + QAction *actAdjust = menu.addAction(tr("Adjust column widths to contents")); QAction *actAlwaysAdjust = @@ -171,10 +165,8 @@ void StackWindow::copyContentsToClipboard() void StackWindow::resizeColumnsToContents() { - resizeColumnToContents(0); - resizeColumnToContents(1); - resizeColumnToContents(2); - resizeColumnToContents(3); + for (int i = model()->columnCount(); --i >= 0; ) + resizeColumnToContents(i); } void StackWindow::setAlwaysResizeColumnsToContents(bool on) @@ -182,10 +174,8 @@ void StackWindow::setAlwaysResizeColumnsToContents(bool on) m_alwaysResizeColumnsToContents = 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); + for (int i = model()->columnCount(); --i >= 0; ) + header()->setResizeMode(i, mode); } } // namespace Internal diff --git a/src/plugins/debugger/stackwindow.h b/src/plugins/debugger/stackwindow.h index 52390bcc34..0256fbeee0 100644 --- a/src/plugins/debugger/stackwindow.h +++ b/src/plugins/debugger/stackwindow.h @@ -61,9 +61,9 @@ public slots: private slots: void rowActivated(const QModelIndex &index); void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); } + void showAddressColumn(bool on); private: - void resizeEvent(QResizeEvent *ev); void contextMenuEvent(QContextMenuEvent *ev); void copyContentsToClipboard(); diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index 1ee5871bbd..ca5e6425b7 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -273,6 +273,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(theDebuggerAction(UseDebuggingHelpers)); menu.addSeparator(); + menu.addAction(theDebuggerAction(UseToolTipsInLocalsView)); QAction *actAdjustColumnWidths = menu.addAction(tr("Adjust column widths to contents")); QAction *actAlwaysAdjustColumnWidth = diff --git a/src/plugins/qmleditor/parser/qmljsastvisitor.cpp b/src/plugins/qmleditor/parser/qmljsastvisitor.cpp index 642bcee26b..d3a1d53068 100644 --- a/src/plugins/qmleditor/parser/qmljsastvisitor.cpp +++ b/src/plugins/qmleditor/parser/qmljsastvisitor.cpp @@ -41,7 +41,7 @@ #include "qmljsastvisitor_p.h" -QT_BEGIN_NAMESPACE +QT_QML_BEGIN_NAMESPACE namespace QmlJS { namespace AST { @@ -55,4 +55,4 @@ Visitor::~Visitor() } } // namespace QmlJS::AST -QT_END_NAMESPACE +QT_QML_END_NAMESPACE |