Qt Labs Forum » Declarative UI

Problem loading multiple components into QmlView

(2 posts)
  • Started 2 months ago by mmiLukas
  • Latest reply from Martin Jones

  1. mmiLukas
    mmiLukas
    Member

    Hi,

    I would like to build and integrate a Qml interface into a QMainWindow. I generate a QmlView, set the Url to a simple helloWorld component and set the QmlView as the central widget of QMainWindow:

    QMainWindow window;
    QmlView *view = new QmlView( this );
    QUrl url = QUrl::fromLocalFile("helloWorld.qml");
    view->setUrl(url);
    window->setCentralWidget( view );

    This works fine. Now how would I do this if I have a main component "ListView.qml" which uses the component "Cell.qml". I tried it via QmlComponent as following but get the error that the type "Cell" is not available in ListView.qml.

    QmlComponent list(engine, "ListView.qml" );
    list.create();
    QmlComponent cell(engine, "Cell.qml" );
    cell.create();

    Really happy for any hints what I am doing wrong.

    Posted: 2 months #
  2. Cell should be found and created automatically when ListView.qml is loaded.

    Posted: 1 month #

RSS feed for this topic

Reply

You must log in to post.



© 2008 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners.