From 02850baf9c7ca284ebc12a1f64375d8381e59fdf Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Tue, 21 Feb 2017 00:14:02 +0100 Subject: [PATCH] logic: Fixed error activation from code caused another show error message --- src/lib_gui/qt/view/QtErrorView.cpp | 5 ++++- src/lib_gui/qt/view/QtErrorView.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib_gui/qt/view/QtErrorView.cpp b/src/lib_gui/qt/view/QtErrorView.cpp index 44fd625f..559b9331 100644 --- a/src/lib_gui/qt/view/QtErrorView.cpp +++ b/src/lib_gui/qt/view/QtErrorView.cpp @@ -48,6 +48,7 @@ QtErrorView::QtErrorView(ViewLayout* viewLayout) , m_refreshFunctor(std::bind(&QtErrorView::doRefreshView, this)) , m_addErrorsFunctor(std::bind(&QtErrorView::doAddErrors, this, std::placeholders::_1, std::placeholders::_2)) , m_setErrorIdFunctor(std::bind(&QtErrorView::doSetErrorId, this, std::placeholders::_1)) + , m_ignoreRowSelection(false) { s_errorIcon = QIcon(QString((ResourcePaths::getGuiPath() + "/indexing_dialog/error.png").c_str())); } @@ -90,7 +91,7 @@ void QtErrorView::initView() connect(m_table->selectionModel(), &QItemSelectionModel::currentRowChanged, [=](const QModelIndex& index, const QModelIndex& previousIndex) { - if (index.isValid()) + if (index.isValid() && !m_ignoreRowSelection) { if (m_model->item(index.row(), COLUMN::FILE) == nullptr) { @@ -174,7 +175,9 @@ void QtErrorView::doSetErrorId(Id errorId) if (items.size() == 1) { + m_ignoreRowSelection = true; m_table->selectRow(items.at(0)->row()); + m_ignoreRowSelection = false; } } diff --git a/src/lib_gui/qt/view/QtErrorView.h b/src/lib_gui/qt/view/QtErrorView.h index b1af56fa..c618d9e1 100644 --- a/src/lib_gui/qt/view/QtErrorView.h +++ b/src/lib_gui/qt/view/QtErrorView.h @@ -71,6 +71,8 @@ private: std::vector m_errors; QPalette* m_palette; + + bool m_ignoreRowSelection; }; #endif // QT_ERROR_VIEW_H