Results 1 to 3 of 3

Thread: Changing the font size and the color of QwtPlot scale labels

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Changing the font size and the color of QwtPlot scale labels

    Hello!

    I would like to know how do one change the Font (particularly the font size) of a QwtPlot's axis labels. Now notice I'm not talking here about the size of a QwtPlot Title, neither am I talking about the size of the title of the axis; I'm talking about the numbers that are displayed in the axis (0, 100,200, etc.). I just can't find the function to change that.

    I would also like to change the color of the axis; for not it's white while the QwtPlot is with black background, and I would like to change the color to black when I put the background to white. I couldn't find the function for that either.

    Any help would be appreciated.

    Momergil
    May the Lord be with you. Always.

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

    Default Re: Changing the font size and the color of QwtPlot scale labels

    The colors of the axes depends on the palette of the scale widget: QPalette::Text is used for the labels, QPalette::Foreground ( = QPalette::WindowText ) for ticks and backbone.
    You can overrule the widget palette by overloading QwtAbstractScaleDraw::label(), where you can set individual colors for each tick label.

    For your use case I would simply do something like "plot->setPalette( Qt::darkGray );". The constructor of QPalette will create colors with good contrasts and all scale widgets inherit the palette from the plot.

    Concerning the font of the tick labels: "plot->axisWidget( ... )->setFont( ... );" Note, that the font can also be overruled in a similar way like the colors.

    Uwe

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

    Momergil (4th December 2014)

Similar Threads

  1. Space between scale and labels in qwtPLot
    By hassinoss in forum Qwt
    Replies: 3
    Last Post: 20th May 2014, 06:41
  2. Replies: 1
    Last Post: 30th March 2012, 16:46
  3. QLabel Font size is not changing???
    By Gokulnathvc in forum Newbie
    Replies: 4
    Last Post: 22nd March 2011, 11:17
  4. Qt Designer Platform specific font size for labels
    By abey in forum Qt Tools
    Replies: 0
    Last Post: 16th February 2011, 16:21
  5. How to re-scale or changing the size of a QGrapicsScene
    By KristianKarl in forum Qt Programming
    Replies: 2
    Last Post: 9th August 2010, 17:34

Tags for this Thread

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.