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:
1 parent
f330a9f853
commit
e7b6bdd7dd
1 file changed
+4
-2
@@ -35,15 +35,17 @@ static const QColor& ColorSchemaToTextForeground(Qt::ColorScheme colorScheme) {
|
|||||||
#endif // defined(Q_OS_WIN)
|
#endif // defined(Q_OS_WIN)
|
||||||
|
|
||||||
switch (colorScheme) {
|
switch (colorScheme) {
|
||||||
case Qt::ColorScheme::Dark:
|
case Qt::ColorScheme::Dark: {
|
||||||
static QColor WHITE = QColor("White");
|
static QColor WHITE = QColor("White");
|
||||||
return WHITE;
|
return WHITE;
|
||||||
|
}
|
||||||
case Qt::ColorScheme::Light:
|
case Qt::ColorScheme::Light:
|
||||||
case Qt::ColorScheme::Unknown:
|
case Qt::ColorScheme::Unknown:
|
||||||
default:
|
default: {
|
||||||
static QColor BLACK = QColor("Black");
|
static QColor BLACK = QColor("Black");
|
||||||
return BLACK;
|
return BLACK;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PGraphicsPixmapItem : public QGraphicsPixmapItem
|
class PGraphicsPixmapItem : public QGraphicsPixmapItem
|
||||||
|
|||||||
Reference in new issue
Block a user