I need more than 1 line for QChart Title
-
One line isn't long enough for the amount of text I need to place in the Title of a QChart using chart->setTitle(_chartTitleText);
Is there a way to display more than one line of text in a QChart title?
thanks
Mike -
@mmikeinsantarosa
(Although I have no evidence for this, I doubt it, judging from other QtsetTitle()
s.) But would it work for you if you inserted\n
into your title? -
@mmikeinsantarosa The Title of a QChart is a
QGraphicsTextItem
so its has automatic wordwarp feature disabled by default. Therefore you'll need to add a manuel linebreakQString("\n")
like @JonB suggestedSets the preferred width for the item's text. If the actual text is wider than the specified width then it will be broken into multiple lines. If width is set to -1 then the text will not be broken into multiple lines unless it is enforced through an explicit line break or a new paragraph. The default value is -1.
-
@JonB said in I need more than 1 line for QChart Title:
@J.Hilk said in I need more than 1 line for QChart Title:
so its has automatic
wordwarp
featureSort of like in Star Trek? :)
oO
Indeed it wraps the QString with warp 10. An operation so fast, speed looses its vector, resulting in black pixel all over the boundingbox .... -
Adding \n just shows up as \n in the title.
Is there a way to enable the wordwarp in the graphicsItem? -
Yes <br> does indeed provide another line in the title.
I tested it with 2 <br>'s and got 3 lines.
Thanks!
Mike