diff --git a/src/core/micamaterial.cpp b/src/core/micamaterial.cpp index ad647c1..3d4af8a 100644 --- a/src/core/micamaterial.cpp +++ b/src/core/micamaterial.cpp @@ -96,15 +96,15 @@ Q_GLOBAL_STATIC(MicaMaterialData, g_micaMaterialData) } #else // !FRAMELESSHELPER_CORE_NO_PRIVATE template -[[nodiscard]] static inline int qt_static_shift(const int value) +[[nodiscard]] static inline constexpr int qt_static_shift(const int value) { - if (shift == 0) { + if constexpr (shift == 0) { return value; - } - if (shift > 0) { + } else if constexpr (shift > 0) { return (value << (quint32(shift) & 0x1f)); + } else { + return (value >> (quint32(-shift) & 0x1f)); } - return (value >> (quint32(-shift) & 0x1f)); } template @@ -155,9 +155,16 @@ static inline void qt_blurrow(QImage &im, const int line, const int alpha) int zR = 0, zG = 0, zB = 0, zA = 0; +#ifdef Q_CC_MSVC +# pragma warning(push) +# pragma warning(disable:4127) // false alarm. +#endif // Q_CC_MSVC if (alphaOnly && (im.format() != QImage::Format_Indexed8)) { bptr += alphaIndex; } +#ifdef Q_CC_MSVC +# pragma warning(pop) +#endif // Q_CC_MSVC const int stride = (im.depth() >> 3); const int im_width = im.width(); diff --git a/src/quick/framelessquickhelper.cpp b/src/quick/framelessquickhelper.cpp index dfbf661..16663cb 100644 --- a/src/quick/framelessquickhelper.cpp +++ b/src/quick/framelessquickhelper.cpp @@ -622,20 +622,20 @@ FramelessQuickHelper *FramelessQuickHelperPrivate::findOrCreateFramelessHelper(Q } QObject *parent = nullptr; QQuickItem *parentItem = nullptr; - if (const auto window = qobject_cast(object)) { - if (QQuickItem * const item = window->contentItem()) { + if (const auto objWindow = qobject_cast(object)) { + if (QQuickItem * const item = objWindow->contentItem()) { parent = item; parentItem = item; } else { - parent = window; + parent = objWindow; } } else if (const auto item = qobject_cast(object)) { - if (QQuickWindow * const window = item->window()) { - if (QQuickItem * const contentItem = window->contentItem()) { + if (QQuickWindow * const itemWindow = item->window()) { + if (QQuickItem * const contentItem = itemWindow->contentItem()) { parent = contentItem; parentItem = contentItem; } else { - parent = window; + parent = itemWindow; parentItem = item; } } else {