[Qt-interest] How to add a superscript text for any QAction item in QMenu

Girish Ramakrishnan girish at forwardbias.in
Mon Apr 6 18:07:20 CEST 2009


Santhosh Y wrote:
> Arnold Krille wrote:
>> On Monday 06 April 2009 12:26:09 Santhosh Y wrote:
>>  
>>> I would like to add superscript text to a QMenu action's text.
>>>     
>>
>> If hypertext is supported inside QAction/QMenu (check by trying) you
>> can make your action-string "Action <sup>TM</sup>" or "<qt>Action
>> <sup>TM</sup></qt>". Or you can even search for the html-entity for
>> the raised TM...
>>
>> Arnold
>>     
> Hi Arnold,
> 
> Thanks for your suggestion.
> 
> But when I tried this, the complete string being coming out including
> <sup> & </sup>.
> 
> But I successfully printed out a message with QMessageBox in the
> following way:
> QMessageBox::critical(this,
>                tr("Hardware report access failed"),
>                tr("Hardware report cannot be viewed by <b>NORMAL</b>
> users"),                              QMessageBox::Ok);
> 
> I am not able to understand why it is not working in Action's case.

QMessageBox supports display rich text whereas QMenu does not.

In your original question, you wanted a raised TM symbol - for that
particular case, you can just append the U+2122 unicode character.

Girish



More information about the Qt-interest-old mailing list