forked from qt-creator/qt-creator
debugger: make views searchable
Change-Id: Icade50bfaa884d88e451e688acf62d6793346628 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -35,39 +35,55 @@
|
|||||||
#include "debuggeractions.h"
|
#include "debuggeractions.h"
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
|
|
||||||
|
#include <aggregation/aggregate.h>
|
||||||
|
#include <coreplugin/findplaceholder.h>
|
||||||
|
#include <find/treeviewfind.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/savedaction.h>
|
#include <utils/savedaction.h>
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
|
#include <QDebug>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
BaseWindow::BaseWindow(QWidget *parent)
|
BaseWindow::BaseWindow(QWidget *parent)
|
||||||
: QTreeView(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
|
QAction *act = debuggerCore()->action(UseAlternatingRowColors);
|
||||||
|
|
||||||
setAttribute(Qt::WA_MacShowFocusRect, false);
|
m_treeView = new QTreeView(this);
|
||||||
setFrameStyle(QFrame::NoFrame);
|
m_treeView->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||||
setAlternatingRowColors(act->isChecked());
|
m_treeView->setFrameStyle(QFrame::NoFrame);
|
||||||
setRootIsDecorated(false);
|
m_treeView->setAlternatingRowColors(act->isChecked());
|
||||||
setIconSize(QSize(10, 10));
|
m_treeView->setRootIsDecorated(false);
|
||||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
m_treeView->setIconSize(QSize(10, 10));
|
||||||
setUniformRowHeights(true);
|
m_treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
m_treeView->setUniformRowHeights(true);
|
||||||
|
|
||||||
header()->setDefaultAlignment(Qt::AlignLeft);
|
m_treeView->header()->setDefaultAlignment(Qt::AlignLeft);
|
||||||
header()->setClickable(true);
|
m_treeView->header()->setClickable(true);
|
||||||
|
|
||||||
connect(act, SIGNAL(toggled(bool)),
|
connect(act, SIGNAL(toggled(bool)),
|
||||||
SLOT(setAlternatingRowColorsHelper(bool)));
|
SLOT(setAlternatingRowColorsHelper(bool)));
|
||||||
connect(this, SIGNAL(activated(QModelIndex)),
|
connect(m_treeView, SIGNAL(activated(QModelIndex)),
|
||||||
SLOT(rowActivatedHelper(QModelIndex)));
|
SLOT(rowActivatedHelper(QModelIndex)));
|
||||||
connect(header(), SIGNAL(sectionClicked(int)),
|
connect(m_treeView->header(), SIGNAL(sectionClicked(int)),
|
||||||
SLOT(headerSectionClicked(int)));
|
SLOT(headerSectionClicked(int)));
|
||||||
|
|
||||||
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||||
|
vbox->setMargin(0);
|
||||||
|
vbox->setSpacing(0);
|
||||||
|
vbox->addWidget(m_treeView);
|
||||||
|
vbox->addWidget(new Core::FindToolBarPlaceHolder(this));
|
||||||
|
|
||||||
|
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
|
||||||
|
agg->add(m_treeView);
|
||||||
|
agg->add(new Find::TreeViewFind(m_treeView));
|
||||||
|
|
||||||
m_adjustColumnsAction = new QAction(tr("Adjust Column Widths to Contents"), 0);
|
m_adjustColumnsAction = new QAction(tr("Adjust Column Widths to Contents"), 0);
|
||||||
m_alwaysAdjustColumnsAction = 0;
|
m_alwaysAdjustColumnsAction = 0;
|
||||||
}
|
}
|
||||||
@@ -108,15 +124,15 @@ bool BaseWindow::handleBaseContextAction(QAction *act)
|
|||||||
|
|
||||||
void BaseWindow::setModel(QAbstractItemModel *model)
|
void BaseWindow::setModel(QAbstractItemModel *model)
|
||||||
{
|
{
|
||||||
QTreeView::setModel(model);
|
m_treeView->setModel(model);
|
||||||
if (header() && m_alwaysAdjustColumnsAction)
|
if (m_treeView->header() && m_alwaysAdjustColumnsAction)
|
||||||
setAlwaysResizeColumnsToContents(m_alwaysAdjustColumnsAction->isChecked());
|
setAlwaysResizeColumnsToContents(m_alwaysAdjustColumnsAction->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseWindow::mousePressEvent(QMouseEvent *ev)
|
void BaseWindow::mousePressEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
QTreeView::mousePressEvent(ev);
|
QWidget::mousePressEvent(ev);
|
||||||
if (!indexAt(ev->pos()).isValid())
|
if (!m_treeView->indexAt(ev->pos()).isValid())
|
||||||
resizeColumnsToContents();
|
resizeColumnsToContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +147,17 @@ void BaseWindow::setAlwaysResizeColumnsToContents(bool on)
|
|||||||
{
|
{
|
||||||
QHeaderView::ResizeMode mode = on
|
QHeaderView::ResizeMode mode = on
|
||||||
? QHeaderView::ResizeToContents : QHeaderView::Interactive;
|
? QHeaderView::ResizeToContents : QHeaderView::Interactive;
|
||||||
header()->setResizeMode(0, mode);
|
m_treeView->header()->setResizeMode(0, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseWindow::setAlternatingRowColorsHelper(bool on)
|
||||||
|
{
|
||||||
|
m_treeView->setAlternatingRowColors(on);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseWindow::rowActivatedHelper(const QModelIndex &index)
|
||||||
|
{
|
||||||
|
rowActivated(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseWindow::headerSectionClicked(int logicalIndex)
|
void BaseWindow::headerSectionClicked(int logicalIndex)
|
||||||
@@ -141,11 +167,24 @@ void BaseWindow::headerSectionClicked(int logicalIndex)
|
|||||||
|
|
||||||
void BaseWindow::reset()
|
void BaseWindow::reset()
|
||||||
{
|
{
|
||||||
QTreeView::reset();
|
m_treeView->reset();
|
||||||
if (header() && m_alwaysAdjustColumnsAction
|
if (m_treeView->header() && m_alwaysAdjustColumnsAction
|
||||||
&& m_alwaysAdjustColumnsAction->isChecked())
|
&& m_alwaysAdjustColumnsAction->isChecked())
|
||||||
resizeColumnsToContents();
|
resizeColumnsToContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QModelIndexList BaseWindow::selectedIndices(QContextMenuEvent *ev)
|
||||||
|
{
|
||||||
|
QItemSelectionModel *sm = treeView()->selectionModel();
|
||||||
|
QTC_ASSERT(sm, return QModelIndexList());
|
||||||
|
QModelIndexList si = sm->selectedIndexes();
|
||||||
|
if (ev) {
|
||||||
|
QModelIndex indexUnderMouse = m_treeView->indexAt(ev->pos());
|
||||||
|
if (si.isEmpty() && indexUnderMouse.isValid())
|
||||||
|
si.append(indexUnderMouse);
|
||||||
|
}
|
||||||
|
return si;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
@@ -38,32 +38,40 @@
|
|||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BaseWindow : public QTreeView
|
class BaseWindow : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BaseWindow(QWidget *parent = 0);
|
BaseWindow(QWidget *parent = 0);
|
||||||
|
virtual void setModel(QAbstractItemModel *model);
|
||||||
|
QHeaderView *header() const { return m_treeView->header(); }
|
||||||
|
QAbstractItemModel *model() const { return m_treeView->model(); }
|
||||||
|
|
||||||
void setAlwaysAdjustColumnsAction(QAction *action);
|
protected slots:
|
||||||
void addBaseContextActions(QMenu *menu);
|
|
||||||
bool handleBaseContextAction(QAction *action);
|
|
||||||
|
|
||||||
void setModel(QAbstractItemModel *model);
|
|
||||||
virtual void rowActivated(const QModelIndex &) {}
|
|
||||||
void mousePressEvent(QMouseEvent *ev);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void resizeColumnsToContents();
|
void resizeColumnsToContents();
|
||||||
void setAlwaysResizeColumnsToContents(bool on);
|
void setAlwaysResizeColumnsToContents(bool on);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
|
void setAlternatingRowColorsHelper(bool on);
|
||||||
void rowActivatedHelper(const QModelIndex &index) { rowActivated(index); }
|
void rowActivatedHelper(const QModelIndex &index);
|
||||||
void headerSectionClicked(int logicalIndex);
|
void headerSectionClicked(int logicalIndex);
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void setAlwaysAdjustColumnsAction(QAction *action);
|
||||||
|
void addBaseContextActions(QMenu *menu);
|
||||||
|
bool handleBaseContextAction(QAction *action);
|
||||||
|
|
||||||
|
QTreeView *treeView() const { return m_treeView; }
|
||||||
|
QModelIndex indexAt(const QPoint &p) const { return m_treeView->indexAt(p); }
|
||||||
|
void resizeColumnToContents(int col) { m_treeView->resizeColumnToContents(col); }
|
||||||
|
void mousePressEvent(QMouseEvent *ev);
|
||||||
|
virtual void rowActivated(const QModelIndex &) {}
|
||||||
|
QModelIndexList selectedIndices(QContextMenuEvent *ev = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QTreeView *m_treeView;
|
||||||
QAction *m_alwaysAdjustColumnsAction;
|
QAction *m_alwaysAdjustColumnsAction;
|
||||||
QAction *m_adjustColumnsAction;
|
QAction *m_adjustColumnsAction;
|
||||||
};
|
};
|
||||||
|
@@ -492,7 +492,7 @@ BreakWindow::BreakWindow(QWidget *parent)
|
|||||||
setWindowTitle(tr("Breakpoints"));
|
setWindowTitle(tr("Breakpoints"));
|
||||||
setObjectName(QLatin1String("ThreadsWindow"));
|
setObjectName(QLatin1String("ThreadsWindow"));
|
||||||
setWindowIcon(QIcon(QLatin1String(":/debugger/images/debugger_breakpoints.png")));
|
setWindowIcon(QIcon(QLatin1String(":/debugger/images/debugger_breakpoints.png")));
|
||||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
treeView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths));
|
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths));
|
||||||
connect(debuggerCore()->action(UseAddressInBreakpointsView),
|
connect(debuggerCore()->action(UseAddressInBreakpointsView),
|
||||||
SIGNAL(toggled(bool)), SLOT(showAddressColumn(bool)));
|
SIGNAL(toggled(bool)), SLOT(showAddressColumn(bool)));
|
||||||
@@ -500,23 +500,23 @@ BreakWindow::BreakWindow(QWidget *parent)
|
|||||||
|
|
||||||
void BreakWindow::showAddressColumn(bool on)
|
void BreakWindow::showAddressColumn(bool on)
|
||||||
{
|
{
|
||||||
setColumnHidden(7, !on);
|
treeView()->setColumnHidden(7, !on);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakWindow::keyPressEvent(QKeyEvent *ev)
|
void BreakWindow::keyPressEvent(QKeyEvent *ev)
|
||||||
{
|
{
|
||||||
if (ev->key() == Qt::Key_Delete) {
|
if (ev->key() == Qt::Key_Delete) {
|
||||||
QItemSelectionModel *sm = selectionModel();
|
QItemSelectionModel *sm = treeView()->selectionModel();
|
||||||
QTC_ASSERT(sm, return);
|
QTC_ASSERT(sm, return);
|
||||||
QModelIndexList si = sm->selectedIndexes();
|
QModelIndexList si = sm->selectedIndexes();
|
||||||
if (si.isEmpty())
|
if (si.isEmpty())
|
||||||
si.append(currentIndex());
|
si.append(treeView()->currentIndex());
|
||||||
const BreakpointModelIds ids = breakHandler()->findBreakpointsByIndex(si);
|
const BreakpointModelIds ids = breakHandler()->findBreakpointsByIndex(si);
|
||||||
int row = qMin(model()->rowCount() - ids.size() - 1, currentIndex().row());
|
int row = qMin(model()->rowCount() - ids.size() - 1, treeView()->currentIndex().row());
|
||||||
deleteBreakpoints(ids);
|
deleteBreakpoints(ids);
|
||||||
setCurrentIndex(si.at(0).sibling(row, 0));
|
treeView()->setCurrentIndex(si.at(0).sibling(row, 0));
|
||||||
}
|
}
|
||||||
QTreeView::keyPressEvent(ev);
|
BaseWindow::keyPressEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakWindow::mouseDoubleClickEvent(QMouseEvent *ev)
|
void BreakWindow::mouseDoubleClickEvent(QMouseEvent *ev)
|
||||||
@@ -526,7 +526,7 @@ void BreakWindow::mouseDoubleClickEvent(QMouseEvent *ev)
|
|||||||
BreakpointModelId id = breakHandler()->findBreakpointByIndex(indexUnderMouse);
|
BreakpointModelId id = breakHandler()->findBreakpointByIndex(indexUnderMouse);
|
||||||
editBreakpoints(BreakpointModelIds() << id);
|
editBreakpoints(BreakpointModelIds() << id);
|
||||||
}
|
}
|
||||||
QTreeView::mouseDoubleClickEvent(ev);
|
BaseWindow::mouseDoubleClickEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakWindow::setModel(QAbstractItemModel *model)
|
void BreakWindow::setModel(QAbstractItemModel *model)
|
||||||
@@ -535,21 +535,16 @@ void BreakWindow::setModel(QAbstractItemModel *model)
|
|||||||
resizeColumnToContents(0); // Number
|
resizeColumnToContents(0); // Number
|
||||||
resizeColumnToContents(3); // Line
|
resizeColumnToContents(3); // Line
|
||||||
resizeColumnToContents(6); // Ignore count
|
resizeColumnToContents(6); // Ignore count
|
||||||
connect(model, SIGNAL(layoutChanged()), this, SLOT(expandAll()));
|
connect(model, SIGNAL(layoutChanged()), treeView(), SLOT(expandAll()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
|
void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QItemSelectionModel *sm = selectionModel();
|
|
||||||
QTC_ASSERT(sm, return);
|
|
||||||
QModelIndexList selectedIndices = sm->selectedIndexes();
|
|
||||||
QModelIndex indexUnderMouse = indexAt(ev->pos());
|
|
||||||
if (selectedIndices.isEmpty() && indexUnderMouse.isValid())
|
|
||||||
selectedIndices.append(indexUnderMouse);
|
|
||||||
|
|
||||||
|
QModelIndexList si = selectedIndices();
|
||||||
BreakHandler *handler = breakHandler();
|
BreakHandler *handler = breakHandler();
|
||||||
BreakpointModelIds selectedIds = handler->findBreakpointsByIndex(selectedIndices);
|
BreakpointModelIds selectedIds = handler->findBreakpointsByIndex(si);
|
||||||
|
|
||||||
const int rowCount = model()->rowCount();
|
const int rowCount = model()->rowCount();
|
||||||
QAction *deleteAction = new QAction(tr("Delete Breakpoint"), &menu);
|
QAction *deleteAction = new QAction(tr("Delete Breakpoint"), &menu);
|
||||||
@@ -561,8 +556,8 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
// Delete by file: Find indices of breakpoints of the same file.
|
// Delete by file: Find indices of breakpoints of the same file.
|
||||||
QAction *deleteByFileAction = 0;
|
QAction *deleteByFileAction = 0;
|
||||||
BreakpointModelIds breakpointsInFile;
|
BreakpointModelIds breakpointsInFile;
|
||||||
if (indexUnderMouse.isValid()) {
|
if (si.size() == 1) {
|
||||||
const QModelIndex index = indexUnderMouse.sibling(indexUnderMouse.row(), 2);
|
const QModelIndex index = si.at(0).sibling(si.at(0).row(), 2);
|
||||||
const QString file = index.data().toString();
|
const QString file = index.data().toString();
|
||||||
if (!file.isEmpty()) {
|
if (!file.isEmpty()) {
|
||||||
for (int i = 0; i != rowCount; ++i)
|
for (int i = 0; i != rowCount; ++i)
|
||||||
|
@@ -1171,15 +1171,15 @@ public:
|
|||||||
BreakWindow *m_breakWindow;
|
BreakWindow *m_breakWindow;
|
||||||
BreakHandler *m_breakHandler;
|
BreakHandler *m_breakHandler;
|
||||||
QtMessageLogWindow *m_qtMessageLogWindow;
|
QtMessageLogWindow *m_qtMessageLogWindow;
|
||||||
QTreeView *m_returnWindow;
|
BaseWindow *m_returnWindow;
|
||||||
QTreeView *m_localsWindow;
|
BaseWindow *m_localsWindow;
|
||||||
QTreeView *m_watchersWindow;
|
BaseWindow *m_watchersWindow;
|
||||||
QAbstractItemView *m_registerWindow;
|
BaseWindow *m_registerWindow;
|
||||||
QAbstractItemView *m_modulesWindow;
|
BaseWindow *m_modulesWindow;
|
||||||
QAbstractItemView *m_snapshotWindow;
|
BaseWindow *m_snapshotWindow;
|
||||||
SourceFilesWindow *m_sourceFilesWindow;
|
SourceFilesWindow *m_sourceFilesWindow;
|
||||||
QAbstractItemView *m_stackWindow;
|
BaseWindow *m_stackWindow;
|
||||||
QAbstractItemView *m_threadsWindow;
|
BaseWindow *m_threadsWindow;
|
||||||
LogWindow *m_logWindow;
|
LogWindow *m_logWindow;
|
||||||
|
|
||||||
bool m_busy;
|
bool m_busy;
|
||||||
|
@@ -61,10 +61,10 @@ ModulesWindow::ModulesWindow(QWidget *parent)
|
|||||||
: BaseWindow(parent)
|
: BaseWindow(parent)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Modules"));
|
setWindowTitle(tr("Modules"));
|
||||||
setSortingEnabled(true);
|
treeView()->setSortingEnabled(true);
|
||||||
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustModulesColumnWidths));
|
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustModulesColumnWidths));
|
||||||
|
|
||||||
connect(this, SIGNAL(activated(QModelIndex)),
|
connect(treeView(), SIGNAL(activated(QModelIndex)),
|
||||||
SLOT(moduleActivated(QModelIndex)));
|
SLOT(moduleActivated(QModelIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
{
|
{
|
||||||
QString name;
|
QString name;
|
||||||
QString fileName;
|
QString fileName;
|
||||||
QModelIndex index = indexAt(ev->pos());
|
QModelIndex index = treeView()->indexAt(ev->pos());
|
||||||
if (index.isValid())
|
if (index.isValid())
|
||||||
index = index.sibling(index.row(), 0);
|
index = index.sibling(index.row(), 0);
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
|
@@ -168,7 +168,7 @@ RegisterWindow::RegisterWindow(QWidget *parent)
|
|||||||
{
|
{
|
||||||
setWindowTitle(tr("Registers"));
|
setWindowTitle(tr("Registers"));
|
||||||
setAlwaysAdjustColumnsAction(debuggerCore()->action(UseAlternatingRowColors));
|
setAlwaysAdjustColumnsAction(debuggerCore()->action(UseAlternatingRowColors));
|
||||||
setItemDelegate(new RegisterDelegate(this));
|
treeView()->setItemDelegate(new RegisterDelegate(this));
|
||||||
setObjectName(QLatin1String("RegisterWindow"));
|
setObjectName(QLatin1String("RegisterWindow"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -71,22 +71,19 @@ void SnapshotWindow::rowActivated(const QModelIndex &index)
|
|||||||
void SnapshotWindow::keyPressEvent(QKeyEvent *ev)
|
void SnapshotWindow::keyPressEvent(QKeyEvent *ev)
|
||||||
{
|
{
|
||||||
if (ev->key() == Qt::Key_Delete) {
|
if (ev->key() == Qt::Key_Delete) {
|
||||||
QItemSelectionModel *sm = selectionModel();
|
QModelIndexList si = selectedIndices();
|
||||||
QTC_ASSERT(sm, return);
|
|
||||||
QModelIndexList si = sm->selectedIndexes();
|
|
||||||
if (si.isEmpty())
|
|
||||||
si.append(currentIndex().sibling(currentIndex().row(), 0));
|
|
||||||
|
|
||||||
foreach (const QModelIndex &idx, si)
|
foreach (const QModelIndex &idx, si)
|
||||||
if (idx.column() == 0)
|
if (idx.column() == 0)
|
||||||
removeSnapshot(idx.row());
|
removeSnapshot(idx.row());
|
||||||
}
|
}
|
||||||
QTreeView::keyPressEvent(ev);
|
BaseWindow::keyPressEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
|
void SnapshotWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
QModelIndex idx = indexAt(ev->pos());
|
QModelIndexList si = selectedIndices(ev);
|
||||||
|
QTC_ASSERT(si.size() == 1, return);
|
||||||
|
QModelIndex idx = si.at(0);
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
|
|
||||||
|
@@ -60,7 +60,7 @@ SourceFilesWindow::SourceFilesWindow(QWidget *parent)
|
|||||||
: BaseWindow(parent)
|
: BaseWindow(parent)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Source Files"));
|
setWindowTitle(tr("Source Files"));
|
||||||
setSortingEnabled(true);
|
treeView()->setSortingEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceFilesWindow::rowActivated(const QModelIndex &index)
|
void SourceFilesWindow::rowActivated(const QModelIndex &index)
|
||||||
@@ -74,7 +74,7 @@ void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
{
|
{
|
||||||
DebuggerEngine *engine = debuggerCore()->currentEngine();
|
DebuggerEngine *engine = debuggerCore()->currentEngine();
|
||||||
QTC_ASSERT(engine, return);
|
QTC_ASSERT(engine, return);
|
||||||
QModelIndex index = indexAt(ev->pos());
|
QModelIndex index = treeView()->indexAt(ev->pos());
|
||||||
index = index.sibling(index.row(), 0);
|
index = index.sibling(index.row(), 0);
|
||||||
QString name = index.data().toString();
|
QString name = index.data().toString();
|
||||||
bool engineActionsEnabled = engine->debuggerActionsEnabled();
|
bool engineActionsEnabled = engine->debuggerActionsEnabled();
|
||||||
|
@@ -76,7 +76,7 @@ StackWindow::StackWindow(QWidget *parent)
|
|||||||
|
|
||||||
void StackWindow::showAddressColumn(bool on)
|
void StackWindow::showAddressColumn(bool on)
|
||||||
{
|
{
|
||||||
setColumnHidden(4, !on);
|
treeView()->setColumnHidden(4, !on);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackWindow::rowActivated(const QModelIndex &index)
|
void StackWindow::rowActivated(const QModelIndex &index)
|
||||||
@@ -121,9 +121,11 @@ static inline StackFrame inputFunctionForDisassembly()
|
|||||||
|
|
||||||
void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
|
void StackWindow::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
{
|
{
|
||||||
|
QModelIndexList si = selectedIndices(ev);
|
||||||
|
QTC_ASSERT(si.size() == 1, return);
|
||||||
DebuggerEngine *engine = currentEngine();
|
DebuggerEngine *engine = currentEngine();
|
||||||
StackHandler *handler = engine->stackHandler();
|
StackHandler *handler = engine->stackHandler();
|
||||||
const QModelIndex index = indexAt(ev->pos());
|
const QModelIndex index = si.at(0);
|
||||||
const int row = index.row();
|
const int row = index.row();
|
||||||
StackFrame frame;
|
StackFrame frame;
|
||||||
if (row >= 0 && row < handler->stackSize())
|
if (row >= 0 && row < handler->stackSize())
|
||||||
|
@@ -52,8 +52,8 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void rowActivated(const QModelIndex &index);
|
void rowActivated(const QModelIndex &index);
|
||||||
void setModel(QAbstractItemModel *model);
|
void setModel(QAbstractItemModel *model);
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
|
||||||
void copyContentsToClipboard();
|
void copyContentsToClipboard();
|
||||||
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -52,7 +52,7 @@ ThreadsWindow::ThreadsWindow(QWidget *parent)
|
|||||||
: BaseWindow(parent)
|
: BaseWindow(parent)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Thread"));
|
setWindowTitle(tr("Thread"));
|
||||||
setSortingEnabled(true);
|
treeView()->setSortingEnabled(true);
|
||||||
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths));
|
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths));
|
||||||
setObjectName(QLatin1String("ThreadsWindow"));
|
setObjectName(QLatin1String("ThreadsWindow"));
|
||||||
}
|
}
|
||||||
|
@@ -485,17 +485,17 @@ WatchWindow::WatchWindow(Type type, QWidget *parent)
|
|||||||
setObjectName(QLatin1String("WatchWindow"));
|
setObjectName(QLatin1String("WatchWindow"));
|
||||||
m_grabbing = false;
|
m_grabbing = false;
|
||||||
setWindowTitle(tr("Locals and Expressions"));
|
setWindowTitle(tr("Locals and Expressions"));
|
||||||
setIndentation(indentation() * 9/10);
|
treeView()->setIndentation(treeView()->indentation() * 9/10);
|
||||||
setUniformRowHeights(true);
|
treeView()->setUniformRowHeights(true);
|
||||||
setItemDelegate(new WatchDelegate(this));
|
treeView()->setItemDelegate(new WatchDelegate(this));
|
||||||
setDragEnabled(true);
|
treeView()->setDragEnabled(true);
|
||||||
setAcceptDrops(true);
|
treeView()->setAcceptDrops(true);
|
||||||
setDropIndicatorShown(true);
|
treeView()->setDropIndicatorShown(true);
|
||||||
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustLocalsColumnWidths));
|
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustLocalsColumnWidths));
|
||||||
|
|
||||||
connect(this, SIGNAL(expanded(QModelIndex)),
|
connect(treeView(), SIGNAL(expanded(QModelIndex)),
|
||||||
SLOT(expandNode(QModelIndex)));
|
SLOT(expandNode(QModelIndex)));
|
||||||
connect(this, SIGNAL(collapsed(QModelIndex)),
|
connect(treeView(), SIGNAL(collapsed(QModelIndex)),
|
||||||
SLOT(collapseNode(QModelIndex)));
|
SLOT(collapseNode(QModelIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,9 +512,10 @@ void WatchWindow::collapseNode(const QModelIndex &idx)
|
|||||||
void WatchWindow::keyPressEvent(QKeyEvent *ev)
|
void WatchWindow::keyPressEvent(QKeyEvent *ev)
|
||||||
{
|
{
|
||||||
if (ev->key() == Qt::Key_Delete && m_type == WatchersType) {
|
if (ev->key() == Qt::Key_Delete && m_type == WatchersType) {
|
||||||
QModelIndexList indices = selectionModel()->selectedRows();
|
QItemSelectionModel *sm = treeView()->selectionModel();
|
||||||
if (indices.isEmpty() && selectionModel()->currentIndex().isValid())
|
QModelIndexList indices = sm->selectedRows();
|
||||||
indices.append(selectionModel()->currentIndex());
|
if (indices.isEmpty() && sm->currentIndex().isValid())
|
||||||
|
indices.append(sm->currentIndex());
|
||||||
QStringList exps;
|
QStringList exps;
|
||||||
foreach (const QModelIndex &idx, indices) {
|
foreach (const QModelIndex &idx, indices) {
|
||||||
QModelIndex idx1 = idx.sibling(idx.row(), 0);
|
QModelIndex idx1 = idx.sibling(idx.row(), 0);
|
||||||
@@ -525,12 +526,12 @@ void WatchWindow::keyPressEvent(QKeyEvent *ev)
|
|||||||
} else if (ev->key() == Qt::Key_Return
|
} else if (ev->key() == Qt::Key_Return
|
||||||
&& ev->modifiers() == Qt::ControlModifier
|
&& ev->modifiers() == Qt::ControlModifier
|
||||||
&& m_type == LocalsType) {
|
&& m_type == LocalsType) {
|
||||||
QModelIndex idx = currentIndex();
|
QModelIndex idx = treeView()->currentIndex();
|
||||||
QModelIndex idx1 = idx.sibling(idx.row(), 0);
|
QModelIndex idx1 = idx.sibling(idx.row(), 0);
|
||||||
QString exp = model()->data(idx1).toString();
|
QString exp = model()->data(idx1).toString();
|
||||||
watchExpression(exp);
|
watchExpression(exp);
|
||||||
}
|
}
|
||||||
QTreeView::keyPressEvent(ev);
|
BaseWindow::keyPressEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchWindow::dragEnterEvent(QDragEnterEvent *ev)
|
void WatchWindow::dragEnterEvent(QDragEnterEvent *ev)
|
||||||
@@ -570,7 +571,7 @@ void WatchWindow::mouseDoubleClickEvent(QMouseEvent *ev)
|
|||||||
watchExpression(QString());
|
watchExpression(QString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QTreeView::mouseDoubleClickEvent(ev);
|
BaseWindow::mouseDoubleClickEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text for add watch action with truncated expression.
|
// Text for add watch action with truncated expression.
|
||||||
@@ -978,7 +979,7 @@ bool WatchWindow::event(QEvent *ev)
|
|||||||
releaseMouse();
|
releaseMouse();
|
||||||
currentEngine()->watchPoint(mapToGlobal(mev->pos()));
|
currentEngine()->watchPoint(mapToGlobal(mev->pos()));
|
||||||
}
|
}
|
||||||
return QTreeView::event(ev);
|
return BaseWindow::event(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchWindow::editItem(const QModelIndex &idx)
|
void WatchWindow::editItem(const QModelIndex &idx)
|
||||||
@@ -989,7 +990,7 @@ void WatchWindow::editItem(const QModelIndex &idx)
|
|||||||
void WatchWindow::setModel(QAbstractItemModel *model)
|
void WatchWindow::setModel(QAbstractItemModel *model)
|
||||||
{
|
{
|
||||||
BaseWindow::setModel(model);
|
BaseWindow::setModel(model);
|
||||||
setRootIsDecorated(true);
|
treeView()->setRootIsDecorated(true);
|
||||||
if (header()) {
|
if (header()) {
|
||||||
header()->setDefaultAlignment(Qt::AlignLeft);
|
header()->setDefaultAlignment(Qt::AlignLeft);
|
||||||
if (m_type != LocalsType)
|
if (m_type != LocalsType)
|
||||||
@@ -1008,8 +1009,8 @@ void WatchWindow::resetHelper(const QModelIndex &idx)
|
|||||||
{
|
{
|
||||||
if (idx.data(LocalsExpandedRole).toBool()) {
|
if (idx.data(LocalsExpandedRole).toBool()) {
|
||||||
//qDebug() << "EXPANDING " << model()->data(idx, INameRole);
|
//qDebug() << "EXPANDING " << model()->data(idx, INameRole);
|
||||||
if (!isExpanded(idx)) {
|
if (!treeView()->isExpanded(idx)) {
|
||||||
expand(idx);
|
treeView()->expand(idx);
|
||||||
for (int i = 0, n = model()->rowCount(idx); i != n; ++i) {
|
for (int i = 0, n = model()->rowCount(idx); i != n; ++i) {
|
||||||
QModelIndex idx1 = model()->index(i, 0, idx);
|
QModelIndex idx1 = model()->index(i, 0, idx);
|
||||||
resetHelper(idx1);
|
resetHelper(idx1);
|
||||||
@@ -1017,8 +1018,8 @@ void WatchWindow::resetHelper(const QModelIndex &idx)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//qDebug() << "COLLAPSING " << model()->data(idx, INameRole);
|
//qDebug() << "COLLAPSING " << model()->data(idx, INameRole);
|
||||||
if (isExpanded(idx))
|
if (treeView()->isExpanded(idx))
|
||||||
collapse(idx);
|
treeView()->collapse(idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user