Results 1 to 5 of 5

Thread: trademark symbol?

  1. #1
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default trademark symbol?

    I'm trying to print the trademark symbol - a superscript TM. But I'm not having any luck. I tried setting it to a font that supports it (like Tahoma and Arial), and put \x99 and \u2122 in a QString. But it just won't print it, all I get is a black rectangle character. Anyone ever have any luck with this?
    Software Engineer



  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: trademark symbol?

    Quote Originally Posted by gfunk View Post
    I tried setting it to a font that supports it (like Tahoma and Arial), and put \x99 and \u2122 in a QString. But it just won't print it, all I get is a black rectangle character.
    I think that the problem is that you put that Unicode character in a non-unicode string. Do you set any codecs using QTextCodec::setCodecForCStrings() or QTextCodec::setCodecForLocale()?

    Try:
    Qt Code:
    1. QString msg( QString( "..." ) + QChar( 0x2122) );
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to jacek for this useful post:

    gfunk (22nd February 2007)

  4. #3
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Thanks
    55
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: trademark symbol?

    Wow! That helped. Yeah, I was putting the character in a non-unicode string. Seems like I should rewrite this code using unicode strings where possible?
    ie. use QString(L"blah") instead of QString("blah") ?
    Software Engineer



  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: trademark symbol?

    If you want to display the string on a QLabel, you can use an sgml entity (i.e. the form &#xxx; )

  6. #5
    Join Date
    Jan 2006
    Posts
    128
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: trademark symbol?

    Quote Originally Posted by gfunk View Post
    Wow! That helped. Yeah, I was putting the character in a non-unicode string. Seems like I should rewrite this code using unicode strings where possible?
    ie. use QString(L"blah") instead of QString("blah") ?
    The cleanest thing is always to use QLatin1String or QString::fromUtf8() and friends.

    This way you make sure that all conversions to unicode (which QString internally uses) are done in a sane way. (And not for example accidently depending on which locale your user has set up...)

    If you want to make really sure that you have no implicit conversions, you can use the defines QT_NO_CAST_FROM_ASCII and QT_NO_CAST_TO_ASCII. Note, that could imply a lot of tedious work to wrap everything though... ;-)

Similar Threads

  1. Replies: 16
    Last Post: 23rd May 2008, 10:12
  2. link error for visual studio.net 2003
    By berlin in forum Newbie
    Replies: 9
    Last Post: 29th September 2006, 16:06
  3. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 22:04
  4. symbol lookup error when using plugins
    By macbeth in forum Qt Programming
    Replies: 3
    Last Post: 29th July 2006, 09:54
  5. Unresolved External Symbol
    By munna in forum General Discussion
    Replies: 1
    Last Post: 10th May 2006, 19:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.