diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 599e876eb..936685a3b 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "common.h" #include "erroritem.h" #include "resultsview.h" @@ -59,6 +60,8 @@ ResultsView::ResultsView(QWidget * parent) : connect(this, &ResultsView::collapseAllResults, mUI.mTree, &ResultsTree::collapseAll); connect(this, &ResultsView::expandAllResults, mUI.mTree, &ResultsTree::expandAll); connect(this, &ResultsView::showHiddenResults, mUI.mTree, &ResultsTree::showHiddenResults); + + mUI.mListLog->setContextMenuPolicy(Qt::CustomContextMenu); } void ResultsView::initialize(QSettings *settings, ApplicationList *list, ThreadHandler *checkThreadHandler) @@ -402,3 +405,18 @@ void ResultsView::debugError(const ErrorItem &item) { mUI.mListLog->addItem(item.ToString()); } + +void ResultsView::log_clear() +{ + mUI.mListLog->clear(); +} + +void ResultsView::on_mListLog_customContextMenuRequested(const QPoint &pos) +{ + QPoint globalPos = mUI.mListLog->mapToGlobal(pos); + + QMenu contextMenu; + contextMenu.addAction(tr("Clear Log"), this, SLOT(log_clear())); + + contextMenu.exec(globalPos); +} diff --git a/gui/resultsview.h b/gui/resultsview.h index ff3d72b59..ac32b3376 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -311,6 +311,11 @@ public slots: */ void debugError(const ErrorItem &item); + /** + * \brief Clear log messages + */ + void log_clear(); + protected: /** * @brief Should we show a "No errors found dialog" every time no errors were found? @@ -320,6 +325,12 @@ protected: Ui::ResultsView mUI; CheckStatistics *mStatistics; +private slots: + /** + * @brief Custom context menu for Analysis Log + * @param pos Mouse click position + */ + void on_mListLog_customContextMenuRequested(const QPoint &pos); }; /// @} #endif // RESULTSVIEW_H