From ca682b20677cb80d14905879594bdd19010af5a8 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Tue, 5 Nov 2019 22:25:08 +0100 Subject: [PATCH] Fix some warnings --- src/CondFormat.cpp | 4 ++++ src/Data.cpp | 2 ++ src/TableBrowser.cpp | 11 ++++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/CondFormat.cpp b/src/CondFormat.cpp index 17242f9d..b9fd0398 100644 --- a/src/CondFormat.cpp +++ b/src/CondFormat.cpp @@ -15,6 +15,8 @@ CondFormat::Alignment CondFormat::fromCombinedAlignment(Qt::Alignment align) return AlignCenter; if (align.testFlag(Qt::AlignJustify)) return AlignJustify; + + return AlignLeft; } CondFormat::CondFormat(const QString& filter, @@ -169,4 +171,6 @@ Qt::AlignmentFlag CondFormat::alignmentFlag() const case AlignJustify: return Qt::AlignJustify; } + + return Qt::AlignLeft; } diff --git a/src/Data.cpp b/src/Data.cpp index b34dfe08..b3310c91 100644 --- a/src/Data.cpp +++ b/src/Data.cpp @@ -56,6 +56,8 @@ bool containsRightToLeft(const QString& text) { case QChar::DirRLO: case QChar::DirRLI: return true; + default: + break; } } return false; diff --git a/src/TableBrowser.cpp b/src/TableBrowser.cpp index 9c31102b..90aa519a 100644 --- a/src/TableBrowser.cpp +++ b/src/TableBrowser.cpp @@ -626,11 +626,11 @@ void TableBrowser::clearAllCondFormats(size_t column) void TableBrowser::clearRowIdFormats(const QModelIndex index) { - std::vector& rowIdFormats = m_settings[currentlyBrowsedTableName()].rowIdFormats[index.column()]; + std::vector& rowIdFormats = m_settings[currentlyBrowsedTableName()].rowIdFormats[static_cast(index.column())]; rowIdFormats.erase(std::remove_if(rowIdFormats.begin(), rowIdFormats.end(), [&](const CondFormat& format) { return format.filter() == QString("=%1").arg(m_model->data(index.sibling(index.row(), 0)).toString()); }), rowIdFormats.end()); - m_model->setCondFormats(true, index.column(), rowIdFormats); + m_model->setCondFormats(true, static_cast(index.column()), rowIdFormats); emit projectModified(); } @@ -650,19 +650,20 @@ void TableBrowser::editCondFormats(size_t column) } void TableBrowser::modifySingleFormat(const bool isRowIdFormat, const QString& filter, const QModelIndex refIndex, std::function changeFunction) { + const size_t column = static_cast(refIndex.column()); BrowseDataTableSettings& settings = m_settings[currentlyBrowsedTableName()]; - std::vector& formats = isRowIdFormat ? settings.rowIdFormats[refIndex.column()] : settings.condFormats[refIndex.column()]; + std::vector& formats = isRowIdFormat ? settings.rowIdFormats[column] : settings.condFormats[column]; auto it = std::find_if(formats.begin(), formats.end(), [&filter](const CondFormat& format) { return format.filter() == filter; }); if(it != formats.end()) { changeFunction(*it); - m_model->addCondFormat(isRowIdFormat, refIndex.column(), *it); + m_model->addCondFormat(isRowIdFormat, column, *it); } else { // Create a new conditional format based on the current reference index and then modify it as requested using the passed function. CondFormat newCondFormat(filter, m_model, refIndex, m_model->encoding()); changeFunction(newCondFormat); - addCondFormat(isRowIdFormat, refIndex.column(), newCondFormat); + addCondFormat(isRowIdFormat, column, newCondFormat); } }