Hi all,
I'm currently developing an application in QT, and using QML for the user interface.
Using QDeclarativeView I am able to create custom objects and access their members from within QML (using the below code), however I am stuck when I want to access the methods from just within main. Currently I am just creating a class for accessing standard functions (StdFuncs class).
Any ideas?
Thanks in advance!
Current main.cpp code:
#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"
#include <QtDeclarative/QDeclarativeContext>
#include "stdfuncs.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QDeclarativeView view;
StdFuncs stdFuncs;
view.rootContext()->setContextProperty("stdFuncs", &stdFuncs);
view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
view.setSource(QUrl::fromLocalFile("qml/ConverterLite/main.qml"));
view.show();
return app.exec();
}