Stylesheet problem with Qt > 5.12.2
-
Hi everybody,
I am facing an issue with the stylesheets, The app worked perfectly until version 5.12.2 and since 5.12.3 there is an issue with the stylesheet setting:
Here is a sreenshot with Qt 5.12.2:
and a the same thing with Qt 5:13:
See the bottom right frame: "Start Exposure"
So I have no idea how to fix it. Here is the code that produces this mess:void QIndigoProperty::update_property_view() {
switch (m_property->state) {
case INDIGO_IDLE_STATE:
m_led->setPixmap(QPixmap(":resource/led-grey.png"));
this->setStyleSheet(
"#INDIGO_property { background-color: #202020 }"
"QLineEdit#INDIGO_property { background-color: #202020}"
"QPushButton#INDIGO_property { background-color: #222222 }"
"QPushButton#INDIGO_property:focus { background-color: #272727 }"
);
break;
case INDIGO_BUSY_STATE:
if (conf.use_state_icons)
m_led->setPixmap(QPixmap(":resource/led-orange-cb.png"));
else
m_led->setPixmap(QPixmap(":resource/led-orange.png"));
this->setStyleSheet(
"#INDIGO_property { background-color: #353520; border: 0px}"
"QLineEdit#INDIGO_property { background-color: #252520}"
"QPushButton#INDIGO_property { background-color: #454522 }"
"QPushButton#INDIGO_property:focus { background-color: #505022 }"
);
break;
case INDIGO_ALERT_STATE:
if (conf.use_state_icons)
m_led->setPixmap(QPixmap(":resource/led-red-cb.png"));
else
m_led->setPixmap(QPixmap(":resource/led-red.png"));
this->setStyleSheet(
"#INDIGO_property { background-color: #352222; border: 0px}"
"QLineEdit#INDIGO_property { background-color: #252222}"
"QPushButton#INDIGO_property { background-color: #452222 }"
"QPushButton#INDIGO_property:focus { background-color: #502222 }"
);
break;
case INDIGO_OK_STATE:
if (conf.use_state_icons)
m_led->setPixmap(QPixmap(":resource/led-green-cb.png"));
else
m_led->setPixmap(QPixmap(":resource/led-green.png"));
this->setStyleSheet(
"#INDIGO_property { background-color: #203220; border: 0px}"
"QLineEdit#INDIGO_property { background-color: #202520}"
"QPushButton#INDIGO_property { background-color: #224322 }"
"QPushButton#INDIGO_property:focus { background-color: #225022 }"
);
break;
}
m_led->update();Any Idea? is that a QT bug?
regards
Rumen -
@Rumen-GB said in Stylesheet problem with Qt > 5.12.2:
See the bottom right frame: "Start Exposure"
Can you be a little bit more precise? Don't see any major difference.
Also it would be nice to get a testcase so we can reproduce it here - your code is too big (and does not compile). -
Hi,
it is a bit tough to reproduce at home as you need indigo framework:
http://indigo-astronomy.org/ in order to use it.But the code is here:
https://github.com/indigo-astronomy/indigo_control_panel
file: qindigoproperty.cpp line: 64The issue is that the child widgets do not get properly decorated when compiled with Qt version > 5.12.2 (see the screenshots in my previous post) It should be all yellow in "Set Exposure" frame but on the bottom screenshot QLabel, QPushButton etc do not change their color and remain green only the frame color changed. While with Qt <= 5.12.2 it is as shown on the first screenshot!
Basically the ide is: it is all green, you hit "Set" button and whie exposure is in progress it should be all yellow which it is when build against Qt <=5.12.2 and is not if newer.I think the trouble code is here:
this->setStyleSheet(
"#INDIGO_property { background-color: #353520; border: 0px}"
"QLineEdit#INDIGO_property { background-color: #252520}"
"QPushButton#INDIGO_property { background-color: #454522 }"
"QPushButton#INDIGO_property:focus { background-color: #505022 }"
);all widgets are named as they should be:
QLabel* device_label = new QLabel(device_string);
device_label->setObjectName("INDIGO_property");regards
Rrumen -
I think this should also be reproducible with a small testcase - please file a bug report at https://bugreports.qt.io and attach the testcase.
-
@Rumen-GB
Hi
While a bug description does help. without a sample to clearly show
the issue / regression, it might not get much love as in many cases its an
application bug and not directly Qt issues.I can see you use Widget Names as selector.
Is the issue you experience like it does ignore the
name and affect another widget even it has other name or what is
the actual thesis about what is broken between the versions ? -
@mrjj the issue is that the stylesheet does not affect the child widgets. It did till qt 5.12.2 and stopped at 5.12.3. It is clearly seen on the screen shots. The frame by default is green. It should change to yellow during the exposure and back to green when done. Both screenshots are during the exposure. Note how buttons and labels keep its green background with 5.13 and are all yellow with 5.12.2. I played a bit and figured that this regression is introduced in 5.12.3
Rumen
-
@mrjj said in Stylesheet problem with Qt > 5.12.2:
it might not get much love as in many cases its an
application bug and not directly Qt issues.That's the reason why I want a small reproducer - to see if it's really a Qt bug or not.
-
@Christian-Ehrlicher I agree but if this worked before 5.12.3 and now it stopped... I would assume it is a regression :)
-
@Rumen-GB said in Stylesheet problem with Qt > 5.12.2:
I would assume it is a regression :)
No matter what you think - if we can not reproduce it with a simple testcase, noone will be able to fix it.
-
Now I can prove it :) I created a test program to illustrate it.
it is all here:
https://bugreports.qt.io/browse/QTBUG-79545 -
@Rumen-GB: thx, I cleaned it up a little bit and can reproduce it.
/edit: and found the solution - is already fixed in 5.12.6
-
@Rumen-GB said in Stylesheet problem with Qt > 5.12.2:
Hi, thanks can this be backported to 5.12.x?
Please read my last post.
-
@Christian-Ehrlicher thank you!