From e7b6bdd7dda1ea67ef9f3597e37f5eed85391e46 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Mon, 12 Oct 2026 16:49:26 +0800 Subject: [PATCH] fix: add braces around switch-case blocks with initialized declarations MSVC rejects declarations with initializers directly under a case label (C2360/C2361: initialization skipped by case/default labels), while GCC/Clang accept them. Wrap the declaring case bodies in braces. --- app/graphicsscene.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/graphicsscene.cpp b/app/graphicsscene.cpp index 53b79d5..3ea78a5 100644 --- a/app/graphicsscene.cpp +++ b/app/graphicsscene.cpp @@ -35,15 +35,17 @@ static const QColor& ColorSchemaToTextForeground(Qt::ColorScheme colorScheme) { #endif // defined(Q_OS_WIN) switch (colorScheme) { - case Qt::ColorScheme::Dark: + case Qt::ColorScheme::Dark: { static QColor WHITE = QColor("White"); return WHITE; + } case Qt::ColorScheme::Light: case Qt::ColorScheme::Unknown: - default: + default: { static QColor BLACK = QColor("Black"); return BLACK; } + } } class PGraphicsPixmapItem : public QGraphicsPixmapItem