c++ - Is there a better way to wordwrap text in QToolTip than just using RegExp? -
so question in title. qtooltip doesn't seem provide wordwraop feature. possible, however, replace nth space \n using regexps, wondering if has suggestion better sollution. specifically, problem approach doesn't take length of text account. example i'd longer texts form wider paragraphs.
if text in tooltip rich text, automatically word-wrapped.
here's trivial example, setting font black makes "rich text" , gets word wrapped. leaving out font declarations means tooltip plain text , extend whole length of screen.
qstring tooltip = qstring("<font color=black>"); tooltip += ("i model of modern major general, i've information vegetable animal , mineral, know kinges of england , quote fights historical marathon waterloo in order categorical..."); tooltip += qstring("</font>"); widget->settooltip(stooltip);
of course example, width of tooltip platform.
there new suggestion in qt bug tracker problem: https://bugreports.qt.io/browse/qtbug-41051. requests width changeable.
Comments
Post a Comment