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.
This commit is contained in:
yyc12345 committed 2026-10-12 16:49:26 +08:00
1 parent f330a9f853
commit e7b6bdd7dd
1 file changed
+4 -2
+4 -2
View File
@@ -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