diff options
author | hjk <qtc-committer@nokia.com> | 2009-03-10 19:35:17 +0100 |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2009-03-10 19:35:17 +0100 |
commit | 6594529f3b45f514e4637a3a8536517075e14095 (patch) | |
tree | b2fc388ce0957d793917123bbc134beb19a8232b /src/plugins/debugger/sourcefileswindow.cpp | |
parent | c37e4426edbc1957cdfd2fd8a3c1bc059f8896be (diff) | |
download | qt-creator-6594529f3b45f514e4637a3a8536517075e14095.tar.gz |
Fixes: debugger: easy access to source files and modules from the
context menu
Diffstat (limited to 'src/plugins/debugger/sourcefileswindow.cpp')
-rw-r--r-- | src/plugins/debugger/sourcefileswindow.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/plugins/debugger/sourcefileswindow.cpp b/src/plugins/debugger/sourcefileswindow.cpp index 91853c357a..1f90bc0d81 100644 --- a/src/plugins/debugger/sourcefileswindow.cpp +++ b/src/plugins/debugger/sourcefileswindow.cpp @@ -178,28 +178,40 @@ SourceFilesWindow::SourceFilesWindow(QWidget *parent) this, SLOT(sourceFileActivated(QModelIndex))); } -SourceFilesWindow::~SourceFilesWindow() -{ -} - void SourceFilesWindow::sourceFileActivated(const QModelIndex &index) { - qDebug() << "ACTIVATED: " << index.row() << index.column(); + qDebug() << "ACTIVATED: " << index.row() << index.column() + << model()->data(index); + emit fileOpenRequested(model()->data(index).toString()); } void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev) { + QModelIndex index = indexAt(ev->pos()); + index = index.sibling(index.row(), 0); + QString name = model()->data(index).toString(); + QMenu menu; QAction *act1 = new QAction(tr("Reload data"), &menu); //act1->setCheckable(true); - + QAction *act2 = 0; + if (name.isEmpty()) { + act2 = new QAction(tr("Open file"), &menu); + act2->setEnabled(false); + } else { + act2 = new QAction(tr("Open file \"%1\"'").arg(name), &menu); + act2->setEnabled(true); + } + menu.addAction(act1); + menu.addAction(act2); QAction *act = menu.exec(ev->globalPos()); - if (act == act1) { + if (act == act1) emit reloadSourceFilesRequested(); - } + else if (act == act2) + emit fileOpenRequested(name); } void SourceFilesWindow::setSourceFiles(const QMap<QString, QString> &sourceFiles) |