Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
Qt Creator 3.1.1
-
None
-
Windows 7 64-bit/ Android 4.2.2 MinGW 4.8
Description
If a Qt Application is deployed from Qt Creator the settings saved from any previous runs of the application are erased.
Consider the following code which has to check if the application has run before (the setting is not found, defaults to false) in order to write out some default values to use because the settings are missing after deployment.
The same code also shows that if the application is restarted on the device without re-deployment, the settings are found and the greeting is correct.
QSettings settings("MyCompany", "MyApplication"); // if the app has been deployed, the settings are missing so this returns false. If the app is restarted, this returns true. bool runOnce = settings.value("runOnce", QVariant(false)).toBool(); if(!runOnce) { // re-create the necessary settings values since the settings are missing settings.setValue("Greeting", "Hello"); // mark the application as having run already. settings.setValue("runOnce", true); } qDebug() << settings.fileName(); // "/data/data/org.qtproject.example.myapplication/files/.config/MyCompany/MyApplication.conf" qDebug() << settings.value("Greeting").toString(); // "Hello" qDebug() << settings.value("runOnce").toBool(); // true
Attachments
Issue Links
- is replaced by
-
QTCREATORBUG-12265 Android: Add option to reinstall application on top of old one
- Closed