diff --git a/src/lib_gui/qt/element/QtTable.cpp b/src/lib_gui/qt/element/QtTable.cpp index 57b1cad7..4d488d97 100644 --- a/src/lib_gui/qt/element/QtTable.cpp +++ b/src/lib_gui/qt/element/QtTable.cpp @@ -79,6 +79,19 @@ void QtTable::updateRows() verticalHeader()->setStyleSheet("::section { width: " + QString::number(width) + "px; }"); verticalHeader()->setDefaultSectionSize(ApplicationSettings::getInstance()->getFontSize() + 6); + + if (this->selectionModel()->hasSelection()) + { + if (selectionModel()->selection().indexes()[0].row() >= model()->rowCount() - 2) + { + clearSelection(); + showLastRow(); + } + } + else + { + showLastRow(); + } } int QtTable::getFilledRowCount() diff --git a/src/lib_gui/qt/view/QtErrorView.cpp b/src/lib_gui/qt/view/QtErrorView.cpp index 31898fe2..0dd5961c 100644 --- a/src/lib_gui/qt/view/QtErrorView.cpp +++ b/src/lib_gui/qt/view/QtErrorView.cpp @@ -59,7 +59,6 @@ void QtErrorView::createWidgetWrapper() setWidgetWrapper(std::make_shared(new QFrame())); } -#include void QtErrorView::initView() { QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this); diff --git a/src/lib_gui/qt/view/QtLogView.cpp b/src/lib_gui/qt/view/QtLogView.cpp index 3f8f6edb..626865b6 100644 --- a/src/lib_gui/qt/view/QtLogView.cpp +++ b/src/lib_gui/qt/view/QtLogView.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "settings/ApplicationSettings.h" @@ -65,7 +66,6 @@ void QtLogView::initView() ); headerLayout->addWidget(m_showAstLogging); headerLayout->addStretch(); - layout->addLayout(headerLayout); m_table = new QtTable(this); @@ -91,6 +91,16 @@ void QtLogView::initView() m_showInfo = createFilterCheckbox("info", filters); filters->addStretch(); + + QPushButton* clearButton = new QPushButton("clear log"); + connect(clearButton, &QPushButton::clicked, + [=]() + { + doClear(); + }); + filters->addWidget(clearButton); + filters->addSpacing(30); + updateMask(); layout->addLayout(filters); @@ -158,6 +168,12 @@ void QtLogView::addLog(Logger::LogLevel type, const LogMessage& message) void QtLogView::doClear() { + if (!m_model->index(0, 0).data(Qt::DisplayRole).toString().isEmpty()) + { + m_model->removeRows(0, m_model->rowCount()); + } + + m_logs.clear(); } void QtLogView::doRefreshView() diff --git a/src/lib_gui/qt/window/QtIndexingDialog.cpp b/src/lib_gui/qt/window/QtIndexingDialog.cpp index a3e7bafe..02a9038c 100644 --- a/src/lib_gui/qt/window/QtIndexingDialog.cpp +++ b/src/lib_gui/qt/window/QtIndexingDialog.cpp @@ -226,7 +226,7 @@ void QtIndexingDialog::handleClose() if (m_type == DIALOG_INDEXING) { - MessageInterruptTasks().dispatchImmediately(); + MessageInterruptTasks().dispatch(); return; }