Skip to content

crystalidea/qt-detect-user-country

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Detect user's country in Qt

When we talk about country we do mean the country set in user Preferences (OS X) or Control Panel (Windows). This is the country that user selects when performing the first OS installation. QLocale::system() often fails here thus the provided function QLocale::Country LocalizationHelpers::detectUserCountry() has special handling on OS X and Windows. You're absolutely welcome to add custom handling for other OS that Qt supports.

detectUserCountry gets country on OS X as set in Preferences under Region:

OS X Region in Preferences

detectUserCountry gets country on Windows as set in Control Panel under Location:

Windows Location in Control Panel

About

Reliable method (QLocale::system() is not) of detecting user's country

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages