Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a superscript in Qt Creator for label text?

I am trying to create a superscript of a 2 to show something is squared for the units label that comes after a field the user supplies in my dialog. I am using Qt Creator v2.0.1 on Windows. The QLabel has a text field and a textFormat field. I attempted to solve this by setting the textFormat combobox to RichText and then set the textFormat field to be: "µm{\super 2}" however, when previewing my dialog, the text is taken literally and not as RichText and thus there is no superscript 2 but instead the '{super 2}' with the backslash removed. I also tried escaping the backslash with '{\super 2}' but I then the literal '{\super 2}' when previewing the dialog.

How can I specify the superscript to Qt Creator so that my dialog preview shows the superscripted 2?

Here is how I want it to look: µm2

like image 464
WilliamKF Avatar asked Jan 12 '11 19:01

WilliamKF


1 Answers

Apparently html works (not sure why RichText did not):

µm<sup>2</sup>
like image 90
WilliamKF Avatar answered Sep 27 '22 18:09

WilliamKF