GUI: Double click on contract to edit it

This commit is contained in:
Daniel Marjamäki 2020-04-29 17:51:25 +02:00
parent daea5e2d6c
commit e89f5ab593
3 changed files with 17 additions and 0 deletions

View File

@ -1607,6 +1607,8 @@ void MainWindow::newProjectFile()
} else { } else {
closeProjectFile(); closeProjectFile();
} }
updateContractsTab();
} }
void MainWindow::closeProjectFile() void MainWindow::closeProjectFile()

View File

@ -62,6 +62,8 @@ ResultsView::ResultsView(QWidget * parent) :
connect(this, &ResultsView::collapseAllResults, mUI.mTree, &ResultsTree::collapseAll); connect(this, &ResultsView::collapseAllResults, mUI.mTree, &ResultsTree::collapseAll);
connect(this, &ResultsView::expandAllResults, mUI.mTree, &ResultsTree::expandAll); connect(this, &ResultsView::expandAllResults, mUI.mTree, &ResultsTree::expandAll);
connect(this, &ResultsView::showHiddenResults, mUI.mTree, &ResultsTree::showHiddenResults); connect(this, &ResultsView::showHiddenResults, mUI.mTree, &ResultsTree::showHiddenResults);
connect(mUI.mListAddedContracts, &QListWidget::itemDoubleClicked, this, &ResultsView::contractDoubleClicked);
connect(mUI.mListMissingContracts, &QListWidget::itemDoubleClicked, this, &ResultsView::contractDoubleClicked);
mUI.mListLog->setContextMenuPolicy(Qt::CustomContextMenu); mUI.mListLog->setContextMenuPolicy(Qt::CustomContextMenu);
@ -93,6 +95,11 @@ void ResultsView::setAddedContracts(const QStringList &addedContracts)
{ {
mUI.mListAddedContracts->clear(); mUI.mListAddedContracts->clear();
mUI.mListAddedContracts->addItems(addedContracts); mUI.mListAddedContracts->addItems(addedContracts);
for (const QString f: addedContracts) {
auto res = mUI.mListMissingContracts->findItems(f, Qt::MatchExactly);
if (!res.empty())
delete res.front();
}
} }
void ResultsView::clear(bool results) void ResultsView::clear(bool results)
@ -485,6 +492,11 @@ void ResultsView::logCopyComplete()
clipboard->setText(logText); clipboard->setText(logText);
} }
void ResultsView::contractDoubleClicked(QListWidgetItem* item)
{
emit editFunctionContract(item->text());
}
void ResultsView::on_mListLog_customContextMenuRequested(const QPoint &pos) void ResultsView::on_mListLog_customContextMenuRequested(const QPoint &pos)
{ {
if (mUI.mListLog->count() <= 0) if (mUI.mListLog->count() <= 0)

View File

@ -348,6 +348,9 @@ public slots:
*/ */
void logCopyComplete(); void logCopyComplete();
/** \brief Contract was double clicked => edit it */
void contractDoubleClicked(QListWidgetItem* item);
protected: protected:
/** /**
* @brief Should we show a "No errors found dialog" every time no errors were found? * @brief Should we show a "No errors found dialog" every time no errors were found?