
Originally Posted by
HappyCoder
I wrote it: Why is the size wrong of the returned font by title().font() ?
I had this same question, and could not make sense of Uwe's answer here. The cause is that there are two different QFonts that apply to the title - one from the QwtText returned from QwtPlot::title() and a different one from the QwtTextLabel returned from QwtPlot::titleLabel().
As HappyCoder demonstrated, plot->title().font() returns:
QFont( "MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0" )
Which you can verify is incorrect/not-in-use by assigning this back to the title by plot->title().setFont(), which results in the font visibly shrinking.
So, instead, plot->titleLabel()->font() gives you the actual initial/default font in the correct size, which returns:
QFont( "MS Shell Dlg 2,14,-1,5,75,0,0,0,0,0" )
For reference, I found this comment/thread that led me to this answer: https://www.qtcentre.org/threads/673...5432#post35432
Bookmarks