Results 1 to 2 of 2

Thread: Set QLocale local once or in every class?

  1. #1
    Join Date
    Oct 2010
    Posts
    91
    Thanks
    38

    Default Set QLocale local once or in every class?

    Hello!

    I would like to use the following code

    Qt Code:
    1. QLocale local;
    2. QString test += local.toString(number, 'f', 2);
    To copy to clipboard, switch view to plain text mode 

    Is there something like qApp-wide variable that contains the QLocale setting or is it neccessary to use
    Qt Code:
    1. QLocale local;
    To copy to clipboard, switch view to plain text mode 
    in every class it is used?

    Kind regards,
    HomeR

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Set QLocale local once or in every class?

    You can use a temporary:
    Qt Code:
    1. QString test += QLocale().toString(number, 'f', 2);
    To copy to clipboard, switch view to plain text mode 

    or a static instance:
    Qt Code:
    1. QString test += QLocale::system().toString(number, 'f', 2);
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    homerun4711 (19th January 2011)

Similar Threads

  1. How does QLocale::toString(double i, char f, int prec) round?
    By ChiliPalmer in forum Qt Programming
    Replies: 0
    Last Post: 10th August 2010, 11:16
  2. Currency Symbol/Sign with QLocale
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2010, 23:52
  3. QLocale/Resource
    By coderbob in forum Newbie
    Replies: 4
    Last Post: 21st November 2007, 20:51
  4. QLocale confusion :(
    By gri in forum Qt Programming
    Replies: 6
    Last Post: 15th June 2007, 13:09
  5. How to get local IP
    By naresh in forum Qt Programming
    Replies: 11
    Last Post: 17th May 2006, 15:48

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.