2013-10-30 11 views
12

Praca z Qt 5 i QtQuick 2,0błąd: 'qmlRegisterType' nie został zadeklarowany w tym zakresie

.pro

# Add more folders to ship with the application, here 
folder_01.source = qml/untitled 
folder_01.target = qml 
DEPLOYMENTFOLDERS = folder_01 

# Additional import path used to resolve QML modules in Creator's code model 
QML_IMPORT_PATH = 

# If your application uses the Qt Mobility libraries, uncomment the following 
# lines and add the respective components to the MOBILITY variable. 
# CONFIG += mobility 
# MOBILITY += 

#CONFIG += qt plugin 
#QT += qml quick 

# The .cpp file which was generated for your project. Feel free to hack it. 
SOURCES += main.cpp \ 
    ../DummyClass.cpp \ 
    ../aa.cpp 

# Installation path 
# target.path = 

# Please do not modify the following two lines. Required for deployment. 
include(qtquick2applicationviewer/qtquick2applicationviewer.pri) 
qtcAddDeployment() 

HEADERS += \ 
    ../DummyClass.h \ 
    ../aa.h 

main.cpp

#include <QtGui/QGuiApplication> 
#include "qtquick2applicationviewer.h" 
#include "/home/***/qmllistproperties/DummyClass.h" 

int main(int argc, char *argv[]) 
{ 
    QGuiApplication app(argc, argv); 

    const char* ocuui = "OCUUI"; // @uri OCUUI 

    qmlRegisterType <DummyClass> (ocuui, 1, 0, "DummyClass"); 

    QtQuick2ApplicationViewer viewer; 
    viewer.setMainQmlFile(QStringLiteral("qml/untitled/main.qml")); 
    viewer.showExpanded(); 

    return app.exec(); 
} 

Odpowiedz

Powiązane problemy