View Single Post
marxian's Avatar
Posts: 2,448 | Thanked: 9,523 times | Joined on Aug 2010 @ Wigan, UK
#9
Originally Posted by KullasH View Post
Hmm.. I have a problem that I just can not figure out by myself.

When I use your qdeclarativesettings.h and *.cpp files it complains about the <QDeclarativeProcess> in main.cpp file. Well, I found your qdeclarativeprocess.h and *.cpp files and that made it.

However it now complains about "...\main.cpp:13: error: no matching function for call to 'qmlRegisterUncreatableType(const char [24], int, int, const char [10])'". Here's the main.cpp file:

Code:
#include <QtGui/QApplication>
#include <QtDeclarative>
#include "qmlapplicationviewer.h"
#include "qdeclarativeprocess.h"
#include "qdeclarativesettings.h"

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));
    QmlApplicationViewer viewer;

    qmlRegisterType<QDeclarativeProcess>("org.component.Processes", 1, 0, "Process");
    qmlRegisterUncreatableType<QDeclarativeProcessEnums>("org.component.Processes", 1, 0, "Processes");

    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile(QLatin1String("qml/filecontrol/main.qml"));
    viewer.showExpanded();

    return app->exec();
}
If I try without the line it complains about (line 13: qmlRegisterUncreatableType<QDeclarativeProcessEnum s>) it works without any problems. Well, then it only displays onError statement in my *.qml file and not the onFinished state.

Any advice what I'm doing wrong here? I have added *.cpp and *.h files in *.pro file so that should not be a problem.
There is a missing argument (the error string) in your call to qmlRegisterUncreatableType. The error string can be anything you like, for example:

Code:
qmlRegisterUncreatableType<QDeclarativeProcessEnums>("org.component.Processes", 1, 0, "Processes", "Cannot be created in QML");
__________________
'Men of high position are allowed, by a special act of grace, to accomodate their reasoning to the answer they need. Logic is only required in those of lesser rank.' - J K Galbraith

My website

GitHub
 

The Following User Says Thank You to marxian For This Useful Post: