|
Qt on Windows ImageMap custom tooltips |
Posted by Michael P on Jun-02-2017 21:00 |
|
Hi Peter,
we are currently showing custom tooltips on our XYCharts using basically this:
setHTMLImageMap("MARKER_total", "", "title='%1n{x2Label}: {value|%2}'");
How can I add custom format to parts of the tooltip, like having the value in bold text?
best regards,
Michael |
Re: Qt on Windows ImageMap custom tooltips |
Posted by Peter Kwan on Jun-03-2017 02:28 |
|
Hi Michael,
Internally in QChartViewer, the Qt tooltip is produced using the standard QToolTip control. You can use Qt's rich text format in QTooltip, but with one important note - that you must escape the '>' character with the HTML escape sequence >. It is because the HTML Image Map itself is already HTML, and the tooltip configuration is essentially one HTML sequence embedded in another HTML document. An example is:
setHTMLImageMap("MARKER_total", "",
QString("title='<b>{x2Label}:</b> {value|%2}'").replace('>', ">").toUtf8());
Hope this can help.
Regards
Peter Kwan |
Re: Qt on Windows ImageMap custom tooltips |
Posted by Michael P on Jun-06-2017 15:20 |
|
Thanks Peter.
I already tried that only to now find out that my newline ("slash"n) included somehow broke the html formatting. Using the "better"
instead everything is fine now.
best regards
Michael |
Re: Qt on Windows ImageMap custom tooltips |
Posted by Michael P on Jun-06-2017 15:57 |
|
Sorry, in the preview the line-break-tag was readable... |
Re: Qt on Windows ImageMap custom tooltips |
Posted by Peter Kwan on Jun-06-2017 16:44 |
|
Hi Michael,
There is a bug in the forum software that previewing will cause the <br> text to become an actual line break in the message.
Regards
Peter Kwan |
|