Results 1 to 2 of 2

Thread: Global stylesheet making QwtPlot become buggy

  1. #1
    Join Date
    Jun 2011
    Porto Alegre, Brazil
    Thanked 2 Times in 2 Posts
    Qt products
    Unix/X11 Windows

    Unhappy Global stylesheet making QwtPlot become buggy


    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.


    At first the code at the .css file included the lines:

    Qt Code:
    1. {
    2. font-family: "Bitstream Vera Sans";
    3. background: rgb(40, 40, 40);
    4. color: rgb(255, 255, 255);
    5. border-color: rgb(255, 255, 255);
    6. }
    To copy to clipboard, switch view to plain text mode 

    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

    Qt Code:
    1. *
    2. {
    3. font-family: "Bitstream Vera Sans";
    4. }
    6. {
    7. background: rgb(40, 40, 40);
    8. color: rgb(255, 255, 255);
    9. border-color: rgb(255, 255, 255);
    10. }
    To copy to clipboard, switch view to plain text mode 

    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:


    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?

    I just tested another code:

    Qt Code:
    1. *
    2. {
    3. font-family: "DejaVu Sans";
    4. }
    6. {
    7. font-family: "Bitstream Vera Sans";
    8. background: rgb(40, 40, 40);
    9. color: rgb(255, 255, 255);
    10. border-color: rgb(255, 255, 255);
    11. }
    To copy to clipboard, switch view to plain text mode 

    , 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.
    Last edited by Momergil; 15th December 2015 at 14:30.
    May the Lord be with you. Always.

  2. #2
    Join Date
    Feb 2006
    Munich, Germany
    Thanked 860 Times in 809 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    MacOS X Unix/X11 Windows

    Default 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, what doesn't include any fonts.

  3. The following user says thank you to Uwe for this useful post:

    Momergil (16th December 2015)

Similar Threads

  1. Replies: 0
    Last Post: 11th June 2015, 17:53
  2. Replies: 8
    Last Post: 17th April 2011, 18:16
  3. Making global QStandardItemModel
    By SykeS in forum Newbie
    Replies: 1
    Last Post: 7th May 2010, 19:46
  4. Replies: 2
    Last Post: 25th January 2010, 21:56
  5. buggy undo example
    By Gopala Krishna in forum Qt Programming
    Replies: 2
    Last Post: 21st August 2007, 20:33

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.