Colour differences in a group box on Windows
-
-
'Settings...' is a QLabel, not a QGroupBox.
-
@Christian-Ehrlicher And it should inherit the background colour from the Groupbox (shouldn't it)?
-
@Perdrix said in Colour differences in a group box on Windows:
And it should inherit the background colour from the Groupbox (shouldn't it)?
I don't know - you did not show any code on what you're doing.
-
@Christian-Ehrlicher Sorry here's my code that sets the colour for the group box:
ui->options->setStyleSheet(QString("background-color: %1").arg(activeGroupColourName));
the variable activeGroupColourName will be either "light-cyan" or "dark-cyan" depending on the active Windows theme.
AFAIK the style background colour should propagate down from the group box to the contained QLabels?
D.
-
You should be long enough here to know that we need a minimal, compilable example to reproduce the problem.
Works fine for me on windows with Qt6.7:int main(int argc, char* argv[]) { QApplication app(argc, argv); QWidget w; w.setStyleSheet("background-color: red"); QHBoxLayout* lay = new QHBoxLayout(&w); QGroupBox* groupBox = new QGroupBox("GroupBox"); QVBoxLayout* vbox = new QVBoxLayout(groupBox); vbox->addWidget(new QLabel("Label 1")); vbox->addWidget(new QLabel("Label 2")); vbox->addWidget(new QLabel("Label 3")); lay->addWidget(groupBox); w.show(); return app.exec(); }
-
@Christian-Ehrlicher Yes, but if I knew how to create the problem, I'd probably know how to fix it!!! In this case I haven't a clue why it is happening.
-
You wanted an answer if you're doing something wrong or if it's a Qt bug. As long as you can't prove that there is a Qt bug (= you can provide a small testcase to reproduce the problem) the answer is - you're doing something wrong. Don't know how we could help here further.
-
@Christian-Ehrlicher Err no, it could still be a Qt problem that I can't work out how to create a small test case for...