Results 1 to 4 of 4

Thread: beta and Alpha and gama Symbols In QLabel

  1. #1
    Join Date
    Jul 2012
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default beta and Alpha and gama Symbols In QLabel

    HI,
    i want to use the symbols of alpha, beta and gama as label of my button
    aftre search in the internet i found just the definition of alpha symbole
    Qt Code:
    1. alpha = QChar(0xb1, 0x03);
    To copy to clipboard, switch view to plain text mode 

    can somone help me to get beta and gama ?

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: beta and Alpha and gama Symbols In QLabel

    The Unicode code points of α, β, and γ are U+03B1, U+03B2, and U+03B3, respectively. You could initialize QChars with with QChar(0x3b1), QChar(0x3b2), and QChar(0x3b3).

    However, you can probably just use the characters in source code directly, e.g. with
    Qt Code:
    1. label->setText("Some text containing α, β, and γ");
    To copy to clipboard, switch view to plain text mode 
    in Qt 5, provided your source file is encoded in UTF-8. If you use Qt 4 and your source file is encoded in UTF-8, you can do
    Qt Code:
    1. label->setText(QString::fromUtf8("Some text containing α, β, and γ"));
    To copy to clipboard, switch view to plain text mode 
    instead.

  3. #3
    Join Date
    Jul 2012
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: beta and Alpha and gama Symbols In QLabel

    Thank you
    i wil try it

  4. #4
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: beta and Alpha and gama Symbols In QLabel

    Note: Unless you have α, β, and γ somewhere on your keyboard, you will need to create the string:
    (1) Using clipboard, copy a string with α, β, and γ on the clipboard then copy it to your code,
    (2) or creating the string in your code
    Qt Code:
    1. QString tmpstring = "Some text containing "
    2.  
    3. tmpstring += QChar(0x3B1);
    4. tmpstring += ", ";
    5. tmpstring += QChar(0x3B2);
    6. tmpstring += ", and ";
    7. tmpstring += QChar(0x3B3);
    8.  
    9. label->setText(tmpstring);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. geting QLabel text ontop of other QLabel displaying image
    By krystosan in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2013, 17:35
  2. Replies: 2
    Last Post: 16th March 2012, 06:55
  3. Replies: 0
    Last Post: 8th November 2010, 21:17
  4. Replies: 1
    Last Post: 29th September 2009, 19:44
  5. Ah3- now in beta
    By croftj in forum Qt-based Software
    Replies: 0
    Last Post: 19th August 2007, 17:56

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.