2 Attachment(s)
Global stylesheet making QwtPlot become buggy
Hi!
I'm developing a software that uses QwtPlot to display a bar graph. This software configures most of its visual configuration by a global .css stylesheet file loaded at startup. Part of the instructions at the .css file includes setting that a given font, namely Bitstream Vera Sans, needs to be used as default font across the system with the exception of some places where the Mono version of this font needs to be used instead.
Attachment 11576
At first the code at the .css file included the lines:
Code:
{
font-family: "Bitstream Vera Sans";
background: rgb(40, 40, 40);
color: rgb(255, 255, 255);
border-color: rgb(255, 255, 255);
}
at the top, with the "font-family line" being repeated for all other widgets mentioned in the .css file. To better organize it (and it wasn't actually covering all widgets), I decided to change the above code to
Code:
*
{
font-family: "Bitstream Vera Sans";
}
{
background: rgb(40, 40, 40);
color: rgb(255, 255, 255);
border-color: rgb(255, 255, 255);
}
while also removing all other calls to the "font-family line".
After doing that, I discovered that the bar graph mentioned above became buggy: it is simply not drawn appropriately any more, but instead only shows the yLeft axis for a second and then even it becomes hidden showing a vertical, empty line instead:
Attachment 11575
I discovered that only by changing the above code to the old one (without returning the "font-family line" to the other widgets) I was able to make the bar graph appear correctly. I even created a recursive function that would return me all widgets significant to the plotting of the bar graph (its parents and parents of parents etc.) and forced them to have the exact same font configuration they possess when the first code is in the .css (that is I made all relevant QWidget based classes behave as if the new code wasn't there), but even this way the bug wouldn't go away.
Any hint on what could possibly be making this QwtPlot go buggy?
EDIT
I just tested another code:
Code:
*
{
font-family: "DejaVu Sans";
}
{
font-family: "Bitstream Vera Sans";
background: rgb(40, 40, 40);
color: rgb(255, 255, 255);
border-color: rgb(255, 255, 255);
}
, so using the "global" system but forcing the default font into it instead of the one I want to use, and the bug didn't appear. The same if I take out the font-family line inside QMainWindow. This serves as an extra evidence that somehow the problem lies in the font being used despite the previously mentioned tests. It would seem that my recursive function isn't actually catching all widgets, with at least one still being missed and also being the responsible for the bug.
Re: Global stylesheet making QwtPlot become buggy
Tried your stylesheet with some Qwt examples without seeing any problems.
But note that the concept of stylesheets is limited for 3rdparty widgets like Qwt - all what is supported is the box model http://doc.qt.io/qt-4.8/stylesheet-customizing.html, what doesn't include any fonts.