ui: clear button in logtab

<description>
This commit is contained in:
Andreas Stallinger
2016-11-14 14:57:56 +01:00
parent 56ab09159b
commit 98573fc6fd
4 changed files with 31 additions and 3 deletions
+13
View File
@@ -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()
-1
View File
@@ -59,7 +59,6 @@ void QtErrorView::createWidgetWrapper()
setWidgetWrapper(std::make_shared<QtViewWidgetWrapper>(new QFrame()));
}
#include <QSortFilterProxyModel>
void QtErrorView::initView()
{
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
+17 -1
View File
@@ -4,6 +4,7 @@
#include <QFrame>
#include <QLabel>
#include <QCheckBox>
#include <QPushButton>
#include <QStandardItemModel>
#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()
+1 -1
View File
@@ -226,7 +226,7 @@ void QtIndexingDialog::handleClose()
if (m_type == DIALOG_INDEXING)
{
MessageInterruptTasks().dispatchImmediately();
MessageInterruptTasks().dispatch();
return;
}