Results 1 to 4 of 4

Thread: CSS Styling for QwtPlotGrid line color (how?)

  1. #1
    Join Date
    Dec 2011
    Posts
    60
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default CSS Styling for QwtPlotGrid line color (how?)

    Following the CSS examples, I have color styling working for all the area of the plot I care about *except* the grid line color. Thank you Uwe.

    I'm using a dark canvas background, so I need to be able to change the grid lines from their default black to a light gray, and (preferably) control their transparency.

    I've tried a number of different ways to get this working, but haven't been successful and didn't see it in the examples.

    I need this last piece to give the user control of the plot style with CSS!

    Please tell the me the grid lines can be styled with CSS.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,313
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: CSS Styling for QwtPlotGrid line color (how?)

    Qt stylesheets is by design a very limited concept - there is not even an idea how to extend it for third party widgets like Qwt. But what you can do is to introduce additional properties - or use the palette of the canvas for the grid colors.

    Uwe

  3. #3
    Join Date
    Dec 2011
    Posts
    60
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: CSS Styling for QwtPlotGrid line color (how?)

    I can see how to set dynamic properties in the code; for example, to set an error state for a text box, and then grab that property in the CSS and style it.

    But, on the CSS-side, I can't figure out how to talk to the grid color, so attaching a property doesn't seem to help me.

    Can you explain a bit more or post a short example?

    Thanks Uwe.

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,313
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: CSS Styling for QwtPlotGrid line color (how?)

    Somehow like below:

    Qt Code:
    1. class YourPlot: plublic QwtPlot
    2. {
    3. Q_OBJECT
    4. Q_PROPERTY( QBrush gridColor READ gridColor WRITE setGridColor )
    5.  
    6. ....
    7.  
    8. };
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. YourPlot {
    2. qproperty-gridColor: ...;
    3. }
    To copy to clipboard, switch view to plain text mode 

    Instead you could also use colors from the canvas palette, that are not in use.

    Uwe

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

    alketi (11th March 2013)

Similar Threads

  1. Replies: 6
    Last Post: 28th March 2012, 00:11
  2. Draw line with inverted background color
    By viswanath in forum Qt Programming
    Replies: 4
    Last Post: 12th November 2011, 03:57
  3. painting in QwtPlotGrid
    By ready in forum Qwt
    Replies: 2
    Last Post: 18th July 2011, 06:26
  4. set a line with and a color?
    By kja in forum Qwt
    Replies: 1
    Last Post: 3rd December 2010, 07:53
  5. QListView Line Color
    By fruzzo in forum Qt Programming
    Replies: 1
    Last Post: 9th May 2008, 09:42

Bookmarks

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.