Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
QCachingLocale speeds up Qt's slow QSystemLocale::query() calls by caching the answers. This seems to be particularly necessary on Mac OS X 10.6.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
How to use in your Qt application --------------------------------- 1) Add the QCachingLocale.h file to your project, and add it to your .pro file. 2) Create a QCachingLocale instance as soon as possible, preferably in the main() function. This will automatically install this object as the system locale and remove any earlier installed system locales. All your QSystemLocale::query() calls will now be cached by QCachingLocale! Developed by Wim Leers (http://wimleers.com/). However, the idea comes from the very helpful user in the #Qt IRC channel with the nickname cbreak (http://the-color-black.net). Thanks again! :) Test case --------- A test case has been provided: https://gist.github.com/708621. Note that this particular test case may only be reproducible on Mac OS X 10.6.5 (it has been reproduced with both Qt 4.6 and Qt 4.7.1). The output will look something like this: Without QCachingLocale: 4839 ms were necessary for parsing the date 1000 times. With QCachingLocale: 23 ms were necessary for parsing the date 1000 times.