[SOLVED] Read/write user settings
-
Getting some troubles. Can you spot what is wrong here? I'm getting error: invalid use of incomplete type 'struct QDeclarativeContext' on line 12:
main.cpp
@#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"
#include "settings.h"Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());// Attaching QSettings wrapper and exposing it to our QML UI Settings* settings = new Settings(app.data()); viewer->rootContext()->setContextProperty("Settings", settings); viewer->setMainQmlFile(QLatin1String("qml/myApp/main.qml")); viewer->showExpanded(); return app->exec();
}@
The only difference here with your code is that currently wizard generated code contains QmlApplicationViewer instance instead of QDeclarativeView (like in your code).
-
Thanks a lot, works now!
-
Hey, is there some way to save image to settings? I have path to the image, how do I save it now to Settings?
-
Thanks. How do I construct QPixmap in QML?
-
-
I'm still sort of confused. Is it possible to construct QPixmap in QML layer, or do I have to do something on C++ side as well?
-
Ok, thanks, I'll try to play with this idea.