forked from qt-creator/qt-creator
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>
This commit is contained in:
125
src/plugins/debugger/basewindow.cpp
Normal file
125
src/plugins/debugger/basewindow.cpp
Normal file
@@ -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
|
||||||
71
src/plugins/debugger/basewindow.h
Normal file
71
src/plugins/debugger/basewindow.h
Normal file
@@ -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
|
||||||
@@ -469,28 +469,15 @@ MultiBreakPointsDialog::MultiBreakPointsDialog(unsigned engineCapabilities, QWid
|
|||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
BreakWindow::BreakWindow(QWidget *parent)
|
BreakWindow::BreakWindow(QWidget *parent)
|
||||||
: QTreeView(parent)
|
: BaseWindow(parent)
|
||||||
{
|
{
|
||||||
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
|
|
||||||
setFrameStyle(QFrame::NoFrame);
|
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
|
||||||
setWindowTitle(tr("Breakpoints"));
|
setWindowTitle(tr("Breakpoints"));
|
||||||
|
setObjectName(QLatin1String("ThreadsWindow"));
|
||||||
setWindowIcon(QIcon(QLatin1String(":/debugger/images/debugger_breakpoints.png")));
|
setWindowIcon(QIcon(QLatin1String(":/debugger/images/debugger_breakpoints.png")));
|
||||||
setAlternatingRowColors(act->isChecked());
|
|
||||||
setRootIsDecorated(false);
|
|
||||||
setIconSize(QSize(10, 10));
|
|
||||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths));
|
||||||
connect(this, SIGNAL(activated(QModelIndex)),
|
|
||||||
SLOT(rowActivated(QModelIndex)));
|
|
||||||
connect(act, SIGNAL(toggled(bool)),
|
|
||||||
SLOT(setAlternatingRowColorsHelper(bool)));
|
|
||||||
connect(debuggerCore()->action(UseAddressInBreakpointsView),
|
connect(debuggerCore()->action(UseAddressInBreakpointsView),
|
||||||
SIGNAL(toggled(bool)),
|
SIGNAL(toggled(bool)), SLOT(showAddressColumn(bool)));
|
||||||
SLOT(showAddressColumn(bool)));
|
|
||||||
connect(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths),
|
|
||||||
SIGNAL(toggled(bool)),
|
|
||||||
SLOT(setAlwaysResizeColumnsToContents(bool)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakWindow::showAddressColumn(bool on)
|
void BreakWindow::showAddressColumn(bool on)
|
||||||
@@ -514,11 +501,6 @@ void BreakWindow::keyPressEvent(QKeyEvent *ev)
|
|||||||
QTreeView::keyPressEvent(ev);
|
QTreeView::keyPressEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakWindow::resizeEvent(QResizeEvent *ev)
|
|
||||||
{
|
|
||||||
QTreeView::resizeEvent(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BreakWindow::mouseDoubleClickEvent(QMouseEvent *ev)
|
void BreakWindow::mouseDoubleClickEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
QModelIndex indexUnderMouse = indexAt(ev->pos());
|
QModelIndex indexUnderMouse = indexAt(ev->pos());
|
||||||
@@ -531,14 +513,10 @@ void BreakWindow::mouseDoubleClickEvent(QMouseEvent *ev)
|
|||||||
|
|
||||||
void BreakWindow::setModel(QAbstractItemModel *model)
|
void BreakWindow::setModel(QAbstractItemModel *model)
|
||||||
{
|
{
|
||||||
QTreeView::setModel(model);
|
BaseWindow::setModel(model);
|
||||||
resizeColumnToContents(0); // Number
|
resizeColumnToContents(0); // Number
|
||||||
resizeColumnToContents(3); // Line
|
resizeColumnToContents(3); // Line
|
||||||
resizeColumnToContents(6); // Ignore count
|
resizeColumnToContents(6); // Ignore count
|
||||||
if (header()) {
|
|
||||||
bool adjust = debuggerCore()->boolSetting(AlwaysAdjustBreakpointsColumnWidths);
|
|
||||||
setAlwaysResizeColumnsToContents(adjust);
|
|
||||||
}
|
|
||||||
connect(model, SIGNAL(layoutChanged()), this, SLOT(expandAll()));
|
connect(model, SIGNAL(layoutChanged()), this, SLOT(expandAll()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,10 +609,7 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
menu.addAction(debuggerCore()->action(UseToolTipsInBreakpointsView));
|
menu.addAction(debuggerCore()->action(UseToolTipsInBreakpointsView));
|
||||||
menu.addAction(debuggerCore()->action(UseAddressInBreakpointsView));
|
menu.addAction(debuggerCore()->action(UseAddressInBreakpointsView));
|
||||||
menu.addAction(adjustColumnAction);
|
addBaseContextActions(&menu);
|
||||||
menu.addAction(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths));
|
|
||||||
menu.addSeparator();
|
|
||||||
menu.addAction(debuggerCore()->action(SettingsDialog));
|
|
||||||
|
|
||||||
QAction *act = menu.exec(ev->globalPos());
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
|
|
||||||
@@ -656,6 +631,8 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
setBreakpointsEnabled(selectedIds, !enabled);
|
setBreakpointsEnabled(selectedIds, !enabled);
|
||||||
else if (act == addBreakpointAction)
|
else if (act == addBreakpointAction)
|
||||||
addBreakpoint();
|
addBreakpoint();
|
||||||
|
else
|
||||||
|
handleBaseContextAction(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakWindow::setBreakpointsEnabled(const BreakpointModelIds &ids, bool enabled)
|
void BreakWindow::setBreakpointsEnabled(const BreakpointModelIds &ids, bool enabled)
|
||||||
@@ -743,20 +720,6 @@ void BreakWindow::associateBreakpoint(const BreakpointModelIds &ids, int threadI
|
|||||||
handler->setThreadSpec(id, threadId);
|
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)
|
void BreakWindow::rowActivated(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
breakHandler()->gotoLocation(breakHandler()->findBreakpointByIndex(index));
|
breakHandler()->gotoLocation(breakHandler()->findBreakpointByIndex(index));
|
||||||
|
|||||||
@@ -34,13 +34,12 @@
|
|||||||
#define DEBUGGER_BREAKWINDOW_H
|
#define DEBUGGER_BREAKWINDOW_H
|
||||||
|
|
||||||
#include "breakpoint.h"
|
#include "breakpoint.h"
|
||||||
|
#include "basewindow.h"
|
||||||
#include <QtGui/QTreeView>
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BreakWindow : public QTreeView
|
class BreakWindow : public BaseWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -51,15 +50,10 @@ public:
|
|||||||
void setModel(QAbstractItemModel *model);
|
void setModel(QAbstractItemModel *model);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void resizeColumnsToContents();
|
|
||||||
void setAlwaysResizeColumnsToContents(bool on);
|
|
||||||
|
|
||||||
void rowActivated(const QModelIndex &index);
|
|
||||||
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
|
||||||
void showAddressColumn(bool on);
|
void showAddressColumn(bool on);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void resizeEvent(QResizeEvent *ev);
|
void rowActivated(const QModelIndex &index);
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
void keyPressEvent(QKeyEvent *ev);
|
void keyPressEvent(QKeyEvent *ev);
|
||||||
void mouseDoubleClickEvent(QMouseEvent *ev);
|
void mouseDoubleClickEvent(QMouseEvent *ev);
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ QT += gui \
|
|||||||
network \
|
network \
|
||||||
script
|
script
|
||||||
|
|
||||||
HEADERS += breakhandler.h \
|
HEADERS += \
|
||||||
|
basewindow.h \
|
||||||
|
breakhandler.h \
|
||||||
breakpoint.h \
|
breakpoint.h \
|
||||||
breakpointmarker.h \
|
breakpointmarker.h \
|
||||||
breakwindow.h \
|
breakwindow.h \
|
||||||
@@ -67,7 +69,9 @@ HEADERS += breakhandler.h \
|
|||||||
debuggersourcepathmappingwidget.h \
|
debuggersourcepathmappingwidget.h \
|
||||||
memoryview.h
|
memoryview.h
|
||||||
|
|
||||||
SOURCES += breakhandler.cpp \
|
SOURCES += \
|
||||||
|
basewindow.cpp \
|
||||||
|
breakhandler.cpp \
|
||||||
breakpoint.cpp \
|
breakpoint.cpp \
|
||||||
breakpointmarker.cpp \
|
breakpointmarker.cpp \
|
||||||
breakwindow.cpp \
|
breakwindow.cpp \
|
||||||
|
|||||||
@@ -58,23 +58,13 @@ namespace Debugger {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ModulesWindow::ModulesWindow(QWidget *parent)
|
ModulesWindow::ModulesWindow(QWidget *parent)
|
||||||
: QTreeView(parent)
|
: BaseWindow(parent)
|
||||||
{
|
{
|
||||||
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
|
|
||||||
setWindowTitle(tr("Modules"));
|
setWindowTitle(tr("Modules"));
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustModulesColumnWidths));
|
||||||
setSortingEnabled(true);
|
|
||||||
setAlternatingRowColors(act->isChecked());
|
|
||||||
setRootIsDecorated(false);
|
|
||||||
setIconSize(QSize(10, 10));
|
|
||||||
|
|
||||||
connect(this, SIGNAL(activated(QModelIndex)),
|
connect(this, SIGNAL(activated(QModelIndex)),
|
||||||
SLOT(moduleActivated(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)
|
void ModulesWindow::moduleActivated(const QModelIndex &index)
|
||||||
@@ -163,19 +153,12 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
menu.addAction(actLoadSymbolsForModule);
|
menu.addAction(actLoadSymbolsForModule);
|
||||||
menu.addAction(actEditFile);
|
menu.addAction(actEditFile);
|
||||||
menu.addAction(actShowModuleSymbols);
|
menu.addAction(actShowModuleSymbols);
|
||||||
menu.addSeparator();
|
addBaseContextActions(&menu);
|
||||||
QAction *actAdjustColumnWidths =
|
|
||||||
menu.addAction(tr("Adjust Column Widths to Contents"));
|
|
||||||
menu.addAction(debuggerCore()->action(AlwaysAdjustModulesColumnWidths));
|
|
||||||
menu.addSeparator();
|
|
||||||
menu.addAction(debuggerCore()->action(SettingsDialog));
|
|
||||||
|
|
||||||
QAction *act = menu.exec(ev->globalPos());
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
|
|
||||||
if (act == actUpdateModuleList)
|
if (act == actUpdateModuleList)
|
||||||
engine->reloadModules();
|
engine->reloadModules();
|
||||||
else if (act == actAdjustColumnWidths)
|
|
||||||
resizeColumnsToContents();
|
|
||||||
else if (act == actShowModuleSources)
|
else if (act == actShowModuleSources)
|
||||||
engine->loadSymbols(name);
|
engine->loadSymbols(name);
|
||||||
else if (act == actLoadSymbolsForAllModules)
|
else if (act == actLoadSymbolsForAllModules)
|
||||||
@@ -190,35 +173,8 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
engine->requestModuleSymbols(name);
|
engine->requestModuleSymbols(name);
|
||||||
else if (actShowDependencies && act == actShowDependencies)
|
else if (actShowDependencies && act == actShowDependencies)
|
||||||
QProcess::startDetached(QLatin1String("depends"), QStringList(fileName));
|
QProcess::startDetached(QLatin1String("depends"), QStringList(fileName));
|
||||||
}
|
else
|
||||||
|
handleBaseContextAction(act);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -33,12 +33,12 @@
|
|||||||
#ifndef DEBUGGER_MODULESWINDOW_H
|
#ifndef DEBUGGER_MODULESWINDOW_H
|
||||||
#define DEBUGGER_MODULESWINDOW_H
|
#define DEBUGGER_MODULESWINDOW_H
|
||||||
|
|
||||||
#include <QtGui/QTreeView>
|
#include "basewindow.h"
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ModulesWindow : public QTreeView
|
class ModulesWindow : public BaseWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -46,14 +46,10 @@ public:
|
|||||||
explicit ModulesWindow(QWidget *parent = 0);
|
explicit ModulesWindow(QWidget *parent = 0);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void resizeColumnsToContents();
|
|
||||||
void setAlwaysResizeColumnsToContents(bool on);
|
|
||||||
void moduleActivated(const QModelIndex &index);
|
void moduleActivated(const QModelIndex &index);
|
||||||
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
void setModel(QAbstractItemModel *model);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -164,21 +164,11 @@ public:
|
|||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
RegisterWindow::RegisterWindow(QWidget *parent)
|
RegisterWindow::RegisterWindow(QWidget *parent)
|
||||||
: QTreeView(parent)
|
: BaseWindow(parent)
|
||||||
{
|
{
|
||||||
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
|
|
||||||
setFrameStyle(QFrame::NoFrame);
|
|
||||||
setWindowTitle(tr("Registers"));
|
setWindowTitle(tr("Registers"));
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
setAlwaysAdjustColumnsAction(debuggerCore()->action(UseAlternatingRowColors));
|
||||||
setAlternatingRowColors(act->isChecked());
|
|
||||||
setRootIsDecorated(false);
|
|
||||||
setItemDelegate(new RegisterDelegate(this));
|
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"));
|
setObjectName(QLatin1String("RegisterWindow"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,20 +235,13 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
QAction *act2 = menu.addAction(tr("Binary"));
|
QAction *act2 = menu.addAction(tr("Binary"));
|
||||||
act2->setCheckable(true);
|
act2->setCheckable(true);
|
||||||
act2->setChecked(base == 2);
|
act2->setChecked(base == 2);
|
||||||
menu.addSeparator();
|
|
||||||
|
|
||||||
QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
|
addBaseContextActions(&menu);
|
||||||
menu.addAction(debuggerCore()->action(AlwaysAdjustRegistersColumnWidths));
|
|
||||||
menu.addSeparator();
|
|
||||||
|
|
||||||
menu.addAction(debuggerCore()->action(SettingsDialog));
|
|
||||||
|
|
||||||
const QPoint position = ev->globalPos();
|
const QPoint position = ev->globalPos();
|
||||||
QAction *act = menu.exec(position);
|
QAction *act = menu.exec(position);
|
||||||
|
|
||||||
if (act == actAdjust)
|
if (act == actReload)
|
||||||
resizeColumnsToContents();
|
|
||||||
else if (act == actReload)
|
|
||||||
engine->reloadRegisters();
|
engine->reloadRegisters();
|
||||||
else if (act == actEditMemory) {
|
else if (act == actEditMemory) {
|
||||||
const QString registerName = QString::fromAscii(aRegister.name, address);
|
const QString registerName = QString::fromAscii(aRegister.name, address);
|
||||||
@@ -285,29 +268,8 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
handler->setNumberBase(8);
|
handler->setNumberBase(8);
|
||||||
else if (act == act2)
|
else if (act == act2)
|
||||||
handler->setNumberBase(2);
|
handler->setNumberBase(2);
|
||||||
}
|
else
|
||||||
|
handleBaseContextAction(act);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterWindow::reloadRegisters()
|
void RegisterWindow::reloadRegisters()
|
||||||
|
|||||||
@@ -33,27 +33,23 @@
|
|||||||
#ifndef DEBUGGER_REGISTERWINDOW_H
|
#ifndef DEBUGGER_REGISTERWINDOW_H
|
||||||
#define DEBUGGER_REGISTERWINDOW_H
|
#define DEBUGGER_REGISTERWINDOW_H
|
||||||
|
|
||||||
#include <QtGui/QTreeView>
|
#include "basewindow.h"
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class RegisterWindow : public QTreeView
|
class RegisterWindow : public BaseWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit RegisterWindow(QWidget *parent = 0);
|
explicit RegisterWindow(QWidget *parent = 0);
|
||||||
void setModel(QAbstractItemModel *model);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void resizeColumnsToContents();
|
|
||||||
void setAlwaysResizeColumnsToContents(bool on);
|
|
||||||
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
|
||||||
void reloadRegisters();
|
void reloadRegisters();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -59,24 +59,8 @@ namespace Internal {
|
|||||||
SnapshotWindow::SnapshotWindow(SnapshotHandler *handler)
|
SnapshotWindow::SnapshotWindow(SnapshotHandler *handler)
|
||||||
{
|
{
|
||||||
m_snapshotHandler = handler;
|
m_snapshotHandler = handler;
|
||||||
|
|
||||||
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
|
|
||||||
setWindowTitle(tr("Snapshots"));
|
setWindowTitle(tr("Snapshots"));
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustSnapshotsColumnWidths));
|
||||||
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)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapshotWindow::rowActivated(const QModelIndex &index)
|
void SnapshotWindow::rowActivated(const QModelIndex &index)
|
||||||
@@ -112,13 +96,8 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
|
|
||||||
QAction *actRemove = menu.addAction(tr("Remove Snapshot"));
|
QAction *actRemove = menu.addAction(tr("Remove Snapshot"));
|
||||||
actRemove->setEnabled(idx.isValid());
|
actRemove->setEnabled(idx.isValid());
|
||||||
menu.addSeparator();
|
|
||||||
|
addBaseContextActions(&menu);
|
||||||
QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
|
|
||||||
menu.addAction(debuggerCore()->action(AlwaysAdjustSnapshotsColumnWidths));
|
|
||||||
menu.addSeparator();
|
|
||||||
|
|
||||||
menu.addAction(debuggerCore()->action(SettingsDialog));
|
|
||||||
|
|
||||||
QAction *act = menu.exec(ev->globalPos());
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
|
|
||||||
@@ -126,8 +105,8 @@ void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
m_snapshotHandler->createSnapshot(idx.row());
|
m_snapshotHandler->createSnapshot(idx.row());
|
||||||
else if (act == actRemove)
|
else if (act == actRemove)
|
||||||
removeSnapshot(idx.row());
|
removeSnapshot(idx.row());
|
||||||
else if (act == actAdjust)
|
else
|
||||||
resizeColumnsToContents();
|
handleBaseContextAction(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapshotWindow::removeSnapshot(int i)
|
void SnapshotWindow::removeSnapshot(int i)
|
||||||
@@ -135,29 +114,5 @@ void SnapshotWindow::removeSnapshot(int i)
|
|||||||
m_snapshotHandler->at(i)->quitDebugger();
|
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 Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|||||||
@@ -33,33 +33,25 @@
|
|||||||
#ifndef DEBUGGER_SNAPSHOTWINDOW_H
|
#ifndef DEBUGGER_SNAPSHOTWINDOW_H
|
||||||
#define DEBUGGER_SNAPSHOTWINDOW_H
|
#define DEBUGGER_SNAPSHOTWINDOW_H
|
||||||
|
|
||||||
#include <QtGui/QTreeView>
|
#include "basewindow.h"
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class SnapshotHandler;
|
class SnapshotHandler;
|
||||||
|
|
||||||
class SnapshotWindow : public QTreeView
|
class SnapshotWindow : public BaseWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SnapshotWindow(SnapshotHandler *handler);
|
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:
|
private:
|
||||||
|
void rowActivated(const QModelIndex &index);
|
||||||
void removeSnapshot(int i);
|
void removeSnapshot(int i);
|
||||||
void keyPressEvent(QKeyEvent *ev);
|
void keyPressEvent(QKeyEvent *ev);
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
void setModel(QAbstractItemModel *model);
|
|
||||||
|
|
||||||
SnapshotHandler *m_snapshotHandler;
|
SnapshotHandler *m_snapshotHandler;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,9 +43,8 @@
|
|||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QContextMenuEvent>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QResizeEvent>
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
@@ -57,41 +56,22 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static DebuggerEngine *currentEngine()
|
|
||||||
{
|
|
||||||
return debuggerCore()->currentEngine();
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceFilesWindow::SourceFilesWindow(QWidget *parent)
|
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"));
|
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);
|
QTC_ASSERT(engine, return);
|
||||||
engine->gotoLocation(index.data().toString());
|
engine->gotoLocation(index.data().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
DebuggerEngine *engine = currentEngine();
|
DebuggerEngine *engine = debuggerCore()->currentEngine();
|
||||||
QTC_ASSERT(engine, return);
|
QTC_ASSERT(engine, return);
|
||||||
QModelIndex index = indexAt(ev->pos());
|
QModelIndex index = indexAt(ev->pos());
|
||||||
index = index.sibling(index.row(), 0);
|
index = index.sibling(index.row(), 0);
|
||||||
@@ -114,8 +94,7 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
|
|
||||||
menu.addAction(act1);
|
menu.addAction(act1);
|
||||||
menu.addAction(act2);
|
menu.addAction(act2);
|
||||||
menu.addSeparator();
|
addBaseContextActions(&menu);
|
||||||
menu.addAction(debuggerCore()->action(SettingsDialog));
|
|
||||||
|
|
||||||
QAction *act = menu.exec(ev->globalPos());
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
|
|
||||||
@@ -123,6 +102,8 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
engine->reloadSourceFiles();
|
engine->reloadSourceFiles();
|
||||||
else if (act == act2)
|
else if (act == act2)
|
||||||
engine->gotoLocation(name);
|
engine->gotoLocation(name);
|
||||||
|
else
|
||||||
|
handleBaseContextAction(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -33,23 +33,20 @@
|
|||||||
#ifndef DEBUGGER_SOURCEFILEWINDOW_H
|
#ifndef DEBUGGER_SOURCEFILEWINDOW_H
|
||||||
#define DEBUGGER_SOURCEFILEWINDOW_H
|
#define DEBUGGER_SOURCEFILEWINDOW_H
|
||||||
|
|
||||||
#include <QtGui/QTreeView>
|
#include "basewindow.h"
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class SourceFilesWindow : public QTreeView
|
class SourceFilesWindow : public BaseWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SourceFilesWindow(QWidget *parent = 0);
|
SourceFilesWindow(QWidget *parent = 0);
|
||||||
|
|
||||||
private slots:
|
|
||||||
void sourceFileActivated(const QModelIndex &index);
|
|
||||||
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void rowActivated(const QModelIndex &index);
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -46,9 +46,9 @@
|
|||||||
|
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QClipboard>
|
#include <QtGui/QClipboard>
|
||||||
|
#include <QtGui/QContextMenuEvent>
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QResizeEvent>
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -59,33 +59,17 @@ static DebuggerEngine *currentEngine()
|
|||||||
}
|
}
|
||||||
|
|
||||||
StackWindow::StackWindow(QWidget *parent)
|
StackWindow::StackWindow(QWidget *parent)
|
||||||
: QTreeView(parent)
|
: BaseWindow(parent)
|
||||||
{
|
{
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
|
||||||
setFrameStyle(QFrame::NoFrame);
|
|
||||||
|
|
||||||
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
|
|
||||||
setWindowTitle(tr("Stack"));
|
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)),
|
connect(debuggerCore()->action(UseAddressInStackView), SIGNAL(toggled(bool)),
|
||||||
SLOT(showAddressColumn(bool)));
|
SLOT(showAddressColumn(bool)));
|
||||||
connect(debuggerCore()->action(ExpandStack), SIGNAL(triggered()),
|
connect(debuggerCore()->action(ExpandStack), SIGNAL(triggered()),
|
||||||
SLOT(reloadFullStack()));
|
SLOT(reloadFullStack()));
|
||||||
connect(debuggerCore()->action(MaximalStackDepth), SIGNAL(triggered()),
|
connect(debuggerCore()->action(MaximalStackDepth), SIGNAL(triggered()),
|
||||||
SLOT(reloadFullStack()));
|
SLOT(reloadFullStack()));
|
||||||
connect(debuggerCore()->action(AlwaysAdjustStackColumnWidths),
|
|
||||||
SIGNAL(triggered(bool)),
|
|
||||||
SLOT(setAlwaysResizeColumnsToContents(bool)));
|
|
||||||
showAddressColumn(false);
|
showAddressColumn(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,14 +85,9 @@ void StackWindow::rowActivated(const QModelIndex &index)
|
|||||||
|
|
||||||
void StackWindow::setModel(QAbstractItemModel *model)
|
void StackWindow::setModel(QAbstractItemModel *model)
|
||||||
{
|
{
|
||||||
QTreeView::setModel(model);
|
BaseWindow::setModel(model);
|
||||||
//resizeColumnsToContents();
|
|
||||||
resizeColumnToContents(0);
|
resizeColumnToContents(0);
|
||||||
resizeColumnToContents(3);
|
resizeColumnToContents(3);
|
||||||
if (header()) {
|
|
||||||
bool adjust = debuggerCore()->boolSetting(AlwaysAdjustStackColumnWidths);
|
|
||||||
setAlwaysResizeColumnsToContents(adjust);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
|
void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
@@ -162,20 +141,12 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
#endif
|
#endif
|
||||||
menu.addAction(debuggerCore()->action(UseAddressInStackView));
|
menu.addAction(debuggerCore()->action(UseAddressInStackView));
|
||||||
|
|
||||||
QAction *actAdjust = menu.addAction(tr("Adjust Column Widths to Contents"));
|
addBaseContextActions(&menu);
|
||||||
menu.addAction(debuggerCore()->action(AlwaysAdjustStackColumnWidths));
|
|
||||||
menu.addSeparator();
|
|
||||||
|
|
||||||
menu.addAction(debuggerCore()->action(SettingsDialog));
|
|
||||||
|
|
||||||
QAction *act = menu.exec(ev->globalPos());
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
|
|
||||||
if (!act)
|
if (act == actCopyContents)
|
||||||
;
|
|
||||||
else if (act == actCopyContents)
|
|
||||||
copyContentsToClipboard();
|
copyContentsToClipboard();
|
||||||
else if (act == actAdjust)
|
|
||||||
resizeColumnsToContents();
|
|
||||||
else if (act == actShowMemory) {
|
else if (act == actShowMemory) {
|
||||||
const QString title = tr("Memory at Frame #%1 (%2) 0x%3").
|
const QString title = tr("Memory at Frame #%1 (%2) 0x%3").
|
||||||
arg(row).arg(frame.function).arg(address, 0, 16);
|
arg(row).arg(frame.function).arg(address, 0, 16);
|
||||||
@@ -193,6 +164,8 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
engine->openDisassemblerView(frame);
|
engine->openDisassemblerView(frame);
|
||||||
else if (act == actLoadSymbols)
|
else if (act == actLoadSymbols)
|
||||||
engine->loadSymbolsForStack();
|
engine->loadSymbolsForStack();
|
||||||
|
else
|
||||||
|
handleBaseContextAction(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackWindow::copyContentsToClipboard()
|
void StackWindow::copyContentsToClipboard()
|
||||||
@@ -220,19 +193,5 @@ void StackWindow::reloadFullStack()
|
|||||||
currentEngine()->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 Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|||||||
@@ -33,29 +33,24 @@
|
|||||||
#ifndef DEBUGGER_STACKWINDOW_H
|
#ifndef DEBUGGER_STACKWINDOW_H
|
||||||
#define DEBUGGER_STACKWINDOW_H
|
#define DEBUGGER_STACKWINDOW_H
|
||||||
|
|
||||||
#include <QtGui/QTreeView>
|
#include "basewindow.h"
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class StackWindow : public QTreeView
|
class StackWindow : public BaseWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StackWindow(QWidget *parent = 0);
|
explicit StackWindow(QWidget *parent = 0);
|
||||||
|
|
||||||
public slots:
|
|
||||||
void resizeColumnsToContents();
|
|
||||||
void setAlwaysResizeColumnsToContents(bool on);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void rowActivated(const QModelIndex &index);
|
|
||||||
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
|
||||||
void showAddressColumn(bool on);
|
void showAddressColumn(bool on);
|
||||||
void reloadFullStack();
|
void reloadFullStack();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void rowActivated(const QModelIndex &index);
|
||||||
void setModel(QAbstractItemModel *model);
|
void setModel(QAbstractItemModel *model);
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
void copyContentsToClipboard();
|
void copyContentsToClipboard();
|
||||||
|
|||||||
@@ -49,26 +49,11 @@ namespace Debugger {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ThreadsWindow::ThreadsWindow(QWidget *parent)
|
ThreadsWindow::ThreadsWindow(QWidget *parent)
|
||||||
: QTreeView(parent)
|
: BaseWindow(parent)
|
||||||
{
|
{
|
||||||
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
|
|
||||||
|
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
|
||||||
setFrameStyle(QFrame::NoFrame);
|
|
||||||
setWindowTitle(tr("Thread"));
|
setWindowTitle(tr("Thread"));
|
||||||
setAlternatingRowColors(act->isChecked());
|
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths));
|
||||||
setRootIsDecorated(false);
|
setObjectName(QLatin1String("ThreadsWindow"));
|
||||||
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)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadsWindow::rowActivated(const QModelIndex &index)
|
void ThreadsWindow::rowActivated(const QModelIndex &index)
|
||||||
@@ -78,48 +63,20 @@ void ThreadsWindow::rowActivated(const QModelIndex &index)
|
|||||||
|
|
||||||
void ThreadsWindow::setModel(QAbstractItemModel *model)
|
void ThreadsWindow::setModel(QAbstractItemModel *model)
|
||||||
{
|
{
|
||||||
QTreeView::setModel(model);
|
BaseWindow::setModel(model);
|
||||||
resizeColumnToContents(ThreadData::IdColumn);
|
resizeColumnToContents(ThreadData::IdColumn);
|
||||||
resizeColumnToContents(ThreadData::LineColumn);
|
resizeColumnToContents(ThreadData::LineColumn);
|
||||||
resizeColumnToContents(ThreadData::NameColumn);
|
resizeColumnToContents(ThreadData::NameColumn);
|
||||||
resizeColumnToContents(ThreadData::StateColumn);
|
resizeColumnToContents(ThreadData::StateColumn);
|
||||||
resizeColumnToContents(ThreadData::TargetIdColumn);
|
resizeColumnToContents(ThreadData::TargetIdColumn);
|
||||||
if (header()) {
|
|
||||||
bool adjust = debuggerCore()->boolSetting(AlwaysAdjustThreadsColumnWidths);
|
|
||||||
setAlwaysResizeColumnsToContents(adjust);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev)
|
void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *adjustColumnAction =
|
addBaseContextActions(&menu);
|
||||||
menu.addAction(tr("Adjust Column Widths to Contents"));
|
|
||||||
menu.addAction(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths));
|
|
||||||
menu.addSeparator();
|
|
||||||
|
|
||||||
menu.addAction(debuggerCore()->action(SettingsDialog));
|
|
||||||
|
|
||||||
QAction *act = menu.exec(ev->globalPos());
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
if (!act)
|
handleBaseContextAction(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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -33,27 +33,20 @@
|
|||||||
#ifndef DEBUGGER_THREADWINDOW_H
|
#ifndef DEBUGGER_THREADWINDOW_H
|
||||||
#define DEBUGGER_THREADWINDOW_H
|
#define DEBUGGER_THREADWINDOW_H
|
||||||
|
|
||||||
#include <QtGui/QTreeView>
|
#include "basewindow.h"
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ThreadsWindow : public QTreeView
|
class ThreadsWindow : public BaseWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ThreadsWindow(QWidget *parent = 0);
|
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:
|
private:
|
||||||
|
void rowActivated(const QModelIndex &index);
|
||||||
void setModel(QAbstractItemModel *model);
|
void setModel(QAbstractItemModel *model);
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -478,14 +478,11 @@ static void addStackLayoutMemoryView(DebuggerEngine *engine, bool separateView,
|
|||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
WatchWindow::WatchWindow(Type type, QWidget *parent)
|
WatchWindow::WatchWindow(Type type, QWidget *parent)
|
||||||
: QTreeView(parent),
|
: BaseWindow(parent),
|
||||||
m_type(type)
|
m_type(type)
|
||||||
{
|
{
|
||||||
setObjectName(QLatin1String("WatchWindow"));
|
setObjectName(QLatin1String("WatchWindow"));
|
||||||
m_grabbing = false;
|
m_grabbing = false;
|
||||||
|
|
||||||
setFrameStyle(QFrame::NoFrame);
|
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
|
||||||
setWindowTitle(tr("Locals and Expressions"));
|
setWindowTitle(tr("Locals and Expressions"));
|
||||||
setIndentation(indentation() * 9/10);
|
setIndentation(indentation() * 9/10);
|
||||||
setUniformRowHeights(true);
|
setUniformRowHeights(true);
|
||||||
@@ -493,16 +490,8 @@ WatchWindow::WatchWindow(Type type, QWidget *parent)
|
|||||||
setDragEnabled(true);
|
setDragEnabled(true);
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
setDropIndicatorShown(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)),
|
connect(this, SIGNAL(expanded(QModelIndex)),
|
||||||
SLOT(expandNode(QModelIndex)));
|
SLOT(expandNode(QModelIndex)));
|
||||||
connect(this, SIGNAL(collapsed(QModelIndex)),
|
connect(this, SIGNAL(collapsed(QModelIndex)),
|
||||||
@@ -864,11 +853,6 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
menu.addAction(debuggerCore()->action(ShowQtNamespace));
|
menu.addAction(debuggerCore()->action(ShowQtNamespace));
|
||||||
menu.addAction(debuggerCore()->action(SortStructMembers));
|
menu.addAction(debuggerCore()->action(SortStructMembers));
|
||||||
|
|
||||||
QAction *actAdjustColumnWidths =
|
|
||||||
menu.addAction(tr("Adjust Column Widths to Contents"));
|
|
||||||
menu.addAction(debuggerCore()->action(AlwaysAdjustLocalsColumnWidths));
|
|
||||||
menu.addSeparator();
|
|
||||||
|
|
||||||
QAction *actClearCodeModelSnapshot
|
QAction *actClearCodeModelSnapshot
|
||||||
= new QAction(tr("Refresh Code Model Snapshot"), &menu);
|
= new QAction(tr("Refresh Code Model Snapshot"), &menu);
|
||||||
actClearCodeModelSnapshot->setEnabled(actionsEnabled
|
actClearCodeModelSnapshot->setEnabled(actionsEnabled
|
||||||
@@ -885,20 +869,17 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
actCloseEditorToolTips->setEnabled(DebuggerToolTipManager::instance()->hasToolTips());
|
actCloseEditorToolTips->setEnabled(DebuggerToolTipManager::instance()->hasToolTips());
|
||||||
menu.addAction(actCloseEditorToolTips);
|
menu.addAction(actCloseEditorToolTips);
|
||||||
|
|
||||||
QAction *act = menu.exec(ev->globalPos());
|
addBaseContextActions(&menu);
|
||||||
if (act == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (act == actAdjustColumnWidths) {
|
QAction *act = menu.exec(ev->globalPos());
|
||||||
resizeColumnsToContents();
|
|
||||||
} else if (act == actInsertNewWatchItem) {
|
if (act == actInsertNewWatchItem) {
|
||||||
bool ok;
|
bool ok;
|
||||||
QString newExp = QInputDialog::getText(this, tr("Enter watch expression"),
|
QString newExp = QInputDialog::getText(this, tr("Enter watch expression"),
|
||||||
tr("Expression:"), QLineEdit::Normal,
|
tr("Expression:"), QLineEdit::Normal,
|
||||||
QString(), &ok);
|
QString(), &ok);
|
||||||
if (ok && !newExp.isEmpty()) {
|
if (ok && !newExp.isEmpty())
|
||||||
watchExpression(newExp);
|
watchExpression(newExp);
|
||||||
}
|
|
||||||
} else if (act == actOpenMemoryEditAtVariableAddress) {
|
} else if (act == actOpenMemoryEditAtVariableAddress) {
|
||||||
addVariableMemoryView(currentEngine(), false, mi0, false, ev->globalPos(), this);
|
addVariableMemoryView(currentEngine(), false, mi0, false, ev->globalPos(), this);
|
||||||
} else if (act == actOpenMemoryEditAtPointerValue) {
|
} else if (act == actOpenMemoryEditAtPointerValue) {
|
||||||
@@ -953,6 +934,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
handler->setUnprintableBase(16);
|
handler->setUnprintableBase(16);
|
||||||
} else if (act == actCloseEditorToolTips) {
|
} else if (act == actCloseEditorToolTips) {
|
||||||
DebuggerToolTipManager::instance()->closeAllToolTips();
|
DebuggerToolTipManager::instance()->closeAllToolTips();
|
||||||
|
} else if (handleBaseContextAction(act)) {
|
||||||
|
;
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i != typeFormatActions.size(); ++i) {
|
for (int i = 0; i != typeFormatActions.size(); ++i) {
|
||||||
if (act == typeFormatActions.at(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)
|
bool WatchWindow::event(QEvent *ev)
|
||||||
{
|
{
|
||||||
if (m_grabbing && ev->type() == QEvent::MouseButtonPress) {
|
if (m_grabbing && ev->type() == QEvent::MouseButtonPress) {
|
||||||
@@ -999,12 +966,9 @@ void WatchWindow::editItem(const QModelIndex &idx)
|
|||||||
|
|
||||||
void WatchWindow::setModel(QAbstractItemModel *model)
|
void WatchWindow::setModel(QAbstractItemModel *model)
|
||||||
{
|
{
|
||||||
QTreeView::setModel(model);
|
BaseWindow::setModel(model);
|
||||||
|
|
||||||
setRootIsDecorated(true);
|
setRootIsDecorated(true);
|
||||||
if (header()) {
|
if (header()) {
|
||||||
setAlwaysResizeColumnsToContents(
|
|
||||||
debuggerCore()->boolSetting(AlwaysAdjustLocalsColumnWidths));
|
|
||||||
header()->setDefaultAlignment(Qt::AlignLeft);
|
header()->setDefaultAlignment(Qt::AlignLeft);
|
||||||
if (m_type != LocalsType)
|
if (m_type != LocalsType)
|
||||||
header()->hide();
|
header()->hide();
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#ifndef DEBUGGER_WATCHWINDOW_H
|
#ifndef DEBUGGER_WATCHWINDOW_H
|
||||||
#define DEBUGGER_WATCHWINDOW_H
|
#define DEBUGGER_WATCHWINDOW_H
|
||||||
|
|
||||||
#include <QtGui/QTreeView>
|
#include "basewindow.h"
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -44,7 +44,7 @@ namespace Internal {
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class WatchWindow : public QTreeView
|
class WatchWindow : public BaseWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -55,9 +55,6 @@ public:
|
|||||||
Type type() const { return m_type; }
|
Type type() const { return m_type; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void resizeColumnsToContents();
|
|
||||||
void setModel(QAbstractItemModel *model);
|
|
||||||
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
|
||||||
void watchExpression(const QString &exp);
|
void watchExpression(const QString &exp);
|
||||||
void removeWatchExpression(const QString &exp);
|
void removeWatchExpression(const QString &exp);
|
||||||
|
|
||||||
@@ -66,8 +63,8 @@ private:
|
|||||||
Q_SLOT void expandNode(const QModelIndex &idx);
|
Q_SLOT void expandNode(const QModelIndex &idx);
|
||||||
Q_SLOT void collapseNode(const QModelIndex &idx);
|
Q_SLOT void collapseNode(const QModelIndex &idx);
|
||||||
Q_SLOT void setUpdatesEnabled(bool enable);
|
Q_SLOT void setUpdatesEnabled(bool enable);
|
||||||
Q_SLOT void setAlwaysResizeColumnsToContents(bool on);
|
|
||||||
|
|
||||||
|
void setModel(QAbstractItemModel *model);
|
||||||
void keyPressEvent(QKeyEvent *ev);
|
void keyPressEvent(QKeyEvent *ev);
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
void dragEnterEvent(QDragEnterEvent *ev);
|
void dragEnterEvent(QDragEnterEvent *ev);
|
||||||
|
|||||||
Reference in New Issue
Block a user