Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-6490

qmlRegisterType non-functional in Qt Creator's Qt Quick Application template for MeeGo

XMLWordPrintable

    • b41237f01ef626381d8519f0703e54a4551f6c36

      Most Qt Quick Apps need to register a C++ item into the QML context. According to the documentation, this is done with qmlRegisterType in main.cpp before loading the qml file.

      However, the latest Qt Quick Application template is designed in a way so that the declarative root context isn't accessible from main.cpp anymore. Extending the qmlapplicationviewer.cpp/.h is necessary, which developers are not supposed to do.

      More detailed description:
      http://meegoharmattandev.blogspot.com/2011/11/qmlapplicationviewer-and.html

      The fix proposed in the blog post is to add new methods to the template:

      qmlapplicationviewer/qmlapplicationviewer.h:

      public:
      QDeclarativeContext *rootContext();

      qmlapplicationviewer/qmlapplicationviewer.cpp:

      QDeclarativeContext *QmlApplicationViewer::rootContext()
      {
      return d->view->rootContext();
      }

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            portale Alessandro Portale
            ajakl Andreas Jakl (closed Nokia identity) (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes