Hi All,
I would like to change the font size of the x axis tick label in the exmaple of "friedberg".
Any suggestion or advice would be really appreciated.
Hi All,
I would like to change the font size of the x axis tick label in the exmaple of "friedberg".
Any suggestion or advice would be really appreciated.
Use void QwtPlot::setAxisFont ( int axisId,const QFont & f ) to set axis font.
For different labels use your own QwtScaleDraw.
1. Inherit from QwtScaleDraw and overload the virtual function QwtText QwtScaleDraw::label(double v) const
2. Return the label with the type of font, size etc. from the function.
3. Use QwtPlot::setAxisScaleDraw to set the scale for the axis in Qwtplot inherited class constructor.
junhonguk (26th April 2012)
For axis font like said pkj use QwtPlot::setAxisFont( int axisId,const QFont & f ).
And for scale labels, use the same method as the title (it's more simple...):
Qt Code:
scaleLabel.setFont(...);To copy to clipboard, switch view to plain text mode
Added after 6 minutes:
I have a question more general on Qwt font management:
Why Qwt does not use a relative font definition with the QApplication::font() ?
I think it's a more useful managment...
Last edited by Guiom; 26th April 2012 at 13:22.
junhonguk (26th April 2012)
It does - Qwt widgets work exactly like any other widget how to find the font for drawing itsself.
But this doesn't work when you need more than one font in one widget ( f.e QwtScaleWidget needs 2 - or even more - different fonts for title and tick labels ) or the element is no widget at all.
But even a QLabel takes the widget font as default only, when no font is explicitely assigned - f.e embedded in rich text, where you could use different fonts for each letter.
Uwe
But in QwtPlot::initPlot the tilte is initialized with an absolute size...
Qt Code:
To copy to clipboard, switch view to plain text mode
Same in QwtPlot::initAxesData()
Qt Code:
To copy to clipboard, switch view to plain text mode
If my application is defined with a font size to 8, plot title, scale label and scales are very big !!
Ah o.k - now I got what you meant.
But whatever ( or no ) default setting is implemented - it will be overwritten in almost every application. Nobody wants to have the same fonts for titles and tick labels.
Taking this into count I agree it might be better to do a useless, but "logical" implementation instead of trying to please a minority.
Uwe
Bookmarks