From acecbd1158fc2e875ccb8cd857cc5bb554020e8f Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 21 May 2023 19:00:36 +0200 Subject: [PATCH] Fix warnings about cv qualifiers droped from `static_cast` return type The change for avoiding a warning from MSVC about 64-bit shift operations introduced a different warning from GCC. Hopefully this now avoids warnings in all compilers. --- paletteeditor/paletteeditor.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/paletteeditor/paletteeditor.cpp b/paletteeditor/paletteeditor.cpp index 1dcfeba..6ad799b 100644 --- a/paletteeditor/paletteeditor.cpp +++ b/paletteeditor/paletteeditor.cpp @@ -14,6 +14,8 @@ #include #include +#include + namespace QtUtilities { enum { BrushRole = 33 }; @@ -72,8 +74,9 @@ void PaletteEditor::setPalette(const QPalette &palette) resolve() #endif ; + using MaskType = std::remove_cv_t; for (int i = 0; i < static_cast(QPalette::NColorRoles); ++i) { - if (mask & (static_cast(1) << static_cast(i))) { + if (mask & (static_cast(1) << static_cast(i))) { continue; } m_editPalette.setBrush( @@ -248,8 +251,9 @@ QPalette PaletteEditor::getPalette(QWidget *parent, const QPalette &init, const resolve() #endif ; + using MaskType = std::remove_cv_t; for (int i = 0; i < static_cast(QPalette::NColorRoles); ++i) { - if (mask & (static_cast(1) << static_cast(i))) { + if (mask & (static_cast(1) << static_cast(i))) { continue; } parentPalette.setBrush( @@ -308,9 +312,8 @@ QVariant PaletteModel::data(const QModelIndex &index, int role) const resolve() #endif ; - if (mask & (static_cast(1) << static_cast(index.row()))) - return true; - return false; + using MaskType = std::remove_cv_t; + return mask & (static_cast(1) << static_cast(index.row())); } return QVariant(); }