From 2135eb982ced3a7e08664c117edd22f5aa8b5c51 Mon Sep 17 00:00:00 2001 From: arnost00 Date: Tue, 28 Jan 2025 18:11:27 +0100 Subject: [PATCH] fix clang-tidy --- .../src/framework/logwidget.cpp | 10 +++------ libqf/libqfqmlwidgets/src/tableview.cpp | 22 +++++++++---------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/libqf/libqfqmlwidgets/src/framework/logwidget.cpp b/libqf/libqfqmlwidgets/src/framework/logwidget.cpp index c7d49343d..fe17b8ecc 100644 --- a/libqf/libqfqmlwidgets/src/framework/logwidget.cpp +++ b/libqf/libqfqmlwidgets/src/framework/logwidget.cpp @@ -20,9 +20,7 @@ namespace qfm = qf::core::model; -namespace qf { -namespace qmlwidgets { -namespace framework { +namespace qf::qmlwidgets::framework { LogWidgetTableView::LogWidgetTableView(QWidget *parent) : Super(parent) @@ -259,7 +257,7 @@ void LogWidget::addCategoryActions(const QString &caption, const QString &id, Ne a->setData(id); a->setMenu(m); tableMenuButton()->addAction(a); - QActionGroup *ag_loglevel = new QActionGroup(a); + auto ag_loglevel = new QActionGroup(a); for (int i = static_cast(NecroLog::Level::Invalid); i <= static_cast(NecroLog::Level::Debug); i++) { if(i == static_cast(NecroLog::Level::Fatal)) continue; @@ -364,6 +362,4 @@ void LogWidget::checkScrollToLastEntry() } } -} // namespace framework -} // namespace qmlwiggets -} // namespace qf +} // namespace framework::qmlwiggets::qf diff --git a/libqf/libqfqmlwidgets/src/tableview.cpp b/libqf/libqfqmlwidgets/src/tableview.cpp index ba0f036a1..788c49e7c 100644 --- a/libqf/libqfqmlwidgets/src/tableview.cpp +++ b/libqf/libqfqmlwidgets/src/tableview.cpp @@ -1151,7 +1151,7 @@ void TableView::rowExternallySaved(const QVariant &id, int mode) tmd->qfm::TableModel::removeRowNoOverload(ri, !qf::core::Exception::Throw); return; } - else if(reloaded_row_cnt != 1) { + if(reloaded_row_cnt != 1) { qfWarning() << "Inserted/Copied row id:" << id.toString() << "reloaded in" << reloaded_row_cnt << "instances."; return; } @@ -1341,7 +1341,7 @@ void TableView::savePersistentSettings() if(!path.isEmpty()) { QSettings settings; settings.beginGroup(path); - HeaderView *horiz_header = qobject_cast(horizontalHeader()); + auto horiz_header = qobject_cast(horizontalHeader()); QByteArray header_state = horiz_header->saveState(); settings.setValue("horizontalheader", QString::fromLatin1(header_state.toBase64())); @@ -1375,12 +1375,12 @@ void TableView::keyPressEvent(QKeyEvent *e) e->accept(); return; } - else if(e->key() == Qt::Key_V) { + if(e->key() == Qt::Key_V) { paste(); e->accept(); return; } - else if(e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) { + if(e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) { qfDebug() << "\tCTRL+ENTER"; postRow(); e->accept(); @@ -1458,9 +1458,7 @@ void TableView::keyPressEvent(QKeyEvent *e) e->accept(); return; } - else { - cancelSeek(); - } + cancelSeek(); //bool event_should_be_accepted = false; /// nejedna se o inkrementalni vyhledavani, zkusime editaci if(state() == EditingState) { @@ -1808,7 +1806,7 @@ void TableView::createActions() a->setOid("select"); m_actionGroups[SelectActions] << a->oid(); m_actions[a->oid()] = a; - QMenu *m = new QMenu(this); + auto m = new QMenu(this); a->setMenu(m); { a = new Action(tr("Select current column"), this); @@ -1835,7 +1833,7 @@ void TableView::createActions() a->setOid("calculate"); m_actionGroups[CalculateActions] << a->oid(); m_actions[a->oid()] = a; - QMenu *m = new QMenu(this); + auto m = new QMenu(this); a->setMenu(m); { a = new Action(tr("Sum column"), this); @@ -1855,7 +1853,7 @@ void TableView::createActions() a->setOid("export"); m_actionGroups[ExportActions] << a->oid(); m_actions[a->oid()] = a; - QMenu *m = new QMenu(this); + auto m = new QMenu(this); a->setMenu(m); { a = new Action(tr("Report"), this); @@ -1900,7 +1898,7 @@ void TableView::createActions() a->setOid("import"); m_actionGroups[ImportActions] << a->oid(); m_actions[a->oid()] = a; - QMenu *m = new QMenu(this); + auto m = new QMenu(this); a->setMenu(m); { a = new Action(tr("CSV"), this); @@ -2126,7 +2124,7 @@ void TableView::insertRowInline() if(tri < 0) { qfWarning() << "Valid proxy model index has invalid table model index!"; /// this can happen when one inserts to empty table ???? why ???? - tri = ri = 0; + tri = 0; } } tableModel()->insertRow(tri);