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,16 +35,18 @@ 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
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user