[SOLVED]How to add an entry in settings app in iOS
-
I am developing a QtQuick application on iOS. The application is completed and working. However, I am currently using hard-coded IP/host information for external communication. Ideally, I would like to add an entry to the Settings that will allow me to supply a user-entered IP/host name. Can someone point me in the right direction?
-
What about regular QSettings in C++? You can expose it (or a light wrapper class with strongly typed enumerated keys) as a context property to access it from QML if needed.
-
What about regular QSettings in C++? You can expose it (or a light wrapper class with strongly typed enumerated keys) as a context property to access it from QML if needed.
@DanWatkins I don't need to access the settings from QML. I can use the QSettings object from my C++ code which supports the QML no problem. What I am having a problem with now is that I don't see the settings entry in the iOS settings app, which is what I am trying to do. Here is the code I have so far:
int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); TDA::TapDisplaySingleton* mainClass = new TDA::TapDisplaySingleton(&app); QObject::connect(&app, SIGNAL(aboutToQuit()), mainClass, SLOT(aboutToQuitApp())); QGuiApplication::setOrganizationName("NASA Langley"); QGuiApplication::setOrganizationDomain("larc.nasa.gov"); QGuiApplication::setApplicationName("TAP Display"); QSettings settings; settings.setValue("HOSTNAME", "localhost"); QTimer::singleShot(10, mainClass, SLOT(run())); return app.exec(); }
When I run the app in simulator, and then check the Settings app, I don't see any entries for my program
-
Hi,
as I said in the previous post I don't know if QSettings is supported in iOS.
A different solution could be use Local Storage. (need to check is is available in iOS) -
Hi,
as I said in the previous post I don't know if QSettings is supported in iOS.
A different solution could be use Local Storage. (need to check is is available in iOS) -
Using QSettings is not really meant to be used the way I was using it. The Apple way to do this is to create a Settings.bundle in your application, which includes a Root.plist file for specifying settings parameters and a Root.strings file for internationalization. To do this in Qt, you need to create the Root.plist and Root.strings file manually and then add the following to your Qt project file
As it turns out, Qt does provide a way to generate a Settings.bundle file for your app. You need to define a Root.plist and Root.strings file in advance and then add the following to you .PRO file:
SETTINGS_BUNDLE_DATA_ROOT.files += Root.plist SETTINGS_BUNDLE_DATA_ROOT.path = Settings.bundle SETTINGS_BUNDLE_DATA_LANG.files += Root.strings SETTINGS_BUNDLE_DATA_LANG.path = Settings.bundle/en.lproj QMAKE_BUNDLE_DATA += SETTINGS_BUNDLE_DATA_ROOT SETTINGS_BUNDLE_DATA_LANG
The bundle will be created upon linking the app