Frage

I want show such tooltip in Qt:

Field1:     some_price1
Field2:     some_price2
Field3:     some_price3

and the second column should be aligned to the right, for example

Field1:     17.50
Field2:      1.57
Field3:    117.50

How can I do it? In the past I use /t and it works perfectly, but now I need html(for coloring) in QToolTip, and only thing I can do is calculate count of spaces, which I need to align prices to the right and put them behind prices.

War es hilfreich?

Lösung

Problem solved in this way:

QString str = QString("<tr><td>Field1:</td><td align=\"right\">%1</td></tr>") + 
              QString("<tr><td>Field2:</td><td align=\"right\">%2</td></tr>");

Thanks for replays.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top