Solved Could not parse stylesheet of object 0x1018c1d50
-
I have an instance of QFrame, here is my xml configuration for the frame:
<frame id="frm1" x="10%" y="10%" width="80%" height="80%" properties="QFrame {background-color: #e9efef; background-image: url('meshtile_4x4.png'); border: 2px solid #cccccc; border-top-left-radius: 8px; border-top-right-radius: 8px; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;}"> <button id="btn1" x="2%" y="2%" width="50%" height="50%" properties="QPushButton {background-color: #4cb9b3; border: 1px solid #3faca6; border-top-left-radius: 0px; border-top-right-radius: 8px; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; color: #ffffff; padding: 1px 18px 1px 3px; min-width: 6em}" shadow="3 3 8 #77000000" checkable="true"> <state value="off" text="Off"/> <state value="on" text="On"/> <signal name="pbtnClicked"> <subscriber sid="win1:title" script="simon2.js@clicked"/> </signal> </button> <button id="btn2" x="60%" y="2%" width="10%" height="50%" properties="QPushButton {background-color: #4cb9b3; border: 1px solid #3faca6; border-top-left-radius: 0px; border-top-right-radius: 8px; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; color: #ffffff; padding: 1px 18px 1px 3px; min-width: 6em}" shadow="3 3 8 #77000000" checkable="true"> <state value="off" text="Off"/> <state value="on" text="On"/> <signal name="pbtnClicked"> <subscriber sid="win1:title" script="simon2.js@clicked"/> </signal> </button> </frame>
My application reads the XML and creates a QFrame for the frame node and a QPushButton for each button node. As the engine renders the XML as its read the QFrame is created initially with no content then as the button nodes are read these are added as children of the QFrame.
When the first button is read and added to the QFrame the parent widget "show" function is called, this is when I get the message:
Could not parse stylesheet of object 0x1018c1d50
The address is not constant I've just posted it here for completeness. What does this message mean?
-
@JonB , found it missing ";" on the last statement before the "}"
-
@SPlatten
You are reading thatproperties="QPushButton {...
in your XML code, and creating aQPushButton
, and setting its stylesheet to that CSS? So if you do something wrong in reading that from the XML and setting it as stylesheet on the button, the message might indicate the CSS is incorrect? -
The thing is the button renders exactly how I would expect and as far as I can see the CSS is perfect. I read the properties attribute and apply the content using setStyleSheet.
-
@SPlatten
Step through your code in the debugger. Watch for exactly when that message appears in the output window. EDIT OK, I see you just get it at.show()
time. Well at least look at the widget'sstyleSheet()
just before you show it, don't assume it's OK, examine it for any slips.Reduce the style you're setting down to one line, see what happens. Get rid of the
properties
completely.Check that the object address does appear to be that of the button you're creating.
Usual debugging techniques....
-
The interesting thing is the message is only displayed when the QFrame widget "show" function is called.
-
@SPlatten
That will be because the stylesheet probably doesn't have to be parsed/applied till show-time. -
@JonB , the address does correspond to the button widget. I will reduce the CSS and see what happens.
-
@JonB , found it missing ";" on the last statement before the "}"