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