Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Portuguese
  4. Int qmlRegisterType ( const char * uri, int versionMajor, int versionMinor, const char * qmlName )

Int qmlRegisterType ( const char * uri, int versionMajor, int versionMinor, const char * qmlName )

Scheduled Pinned Locked Moved Portuguese
2 Posts 1 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thiago Moura
    wrote on last edited by
    #1

    Bom dia Galera!

    Sou novo no que se refere ao QT...rs uso visual studio 2010. Estamos migrando aos poucos o Qt em nossos projetos pois utilizamos muitas interfaces gráficas. Criei 1 classes Singleton .h e .cpp conforme abaixo:

    @
    #if !defined( SINGLETONQMLENGINE_H )
    #define SINGLETONQMLENGINE_H

    #include <QObject>
    #include <QSqlQueryModel>
    #include <QSqlRecord>
    #include <QSqlQuery>
    #include <QtDeclarative>
    #include <QDeclarativeEngine>
    #include <QDeclarativeComponent>
    #include <QUrl>

    using namespace std;

    class SingletonQmlEngine
    {

    private:
    int value;

    SingletonQmlEngine(){};
    
    SingletonQmlEngine(const SingletonQmlEngine &);
    SingletonQmlEngine operator=(const SingletonQmlEngine &);
    

    public:
    ~SingletonQmlEngine(){};

    int GetValue() const { return value; }
    void SetValue(int newValue) { value = newValue; }
    
    static SingletonQmlEngine* Instance();
    

    public:

    void qmlstart();
    void engine();

    };

    #endif // SINGLETONQMLENGINE_H

    ///////////////////////////////////////////////////////////////////////////

    #include "singletonqmlengine.h"
    #include <QDeclarativeComponent.h>
    #include <QDeclarativeEngine.h>
    #include <QtDeclarative>
    #include "singletondashboardcontroller.h"

    SingletonQmlEngine* SingletonQmlEngine::Instance()
    {
    static SingletonQmlEngine instance;
    return &instance;
    }

    void SingletonQmlEngine::qmlstart()

    {
    int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName);
    qmlRegisterType<SingletonDashboardController>("comm5.com.br", 1, 0, "Dashboard");
    }

    void SingletonQmlEngine::engine()
    {

    QDeclarativeComponent component( QDeclarativeEngine *engine, const QUrl & url, QObject * parent = 0);

    }

    @

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    Como se pode ver acima, estou tentando definir uma função chamada qmlstart usando qmlRegisterType que pelo o que li no site, é quem é responsável pelos registros de classes. Esta função será chamada por outra classe, mas isso ainda não vem ao caso ainda...porém ao tentar registrar a classe a ser chamada "SingletonDashboardControler"@@ me gera um erro de sintax provalvelmente: "type name is not allowed" gostaria de saber onde estou errando!

    Desde já grato...

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Thiago Moura
      wrote on last edited by
      #2

      Bom galera já consegui obter um resultado positivo na minha dúvida com um colega! vlw

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved