×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    506

    lost in contexts

    Hi

    I have several QML items in my app, each of them using ListView to show data from C++ side
    Currently I'm using separate a QDeclarativeEngine object for each QML item, but I thing its waste of memory
    But when I'm trying to use one QDeclarativeEngine for all items, and call context->setContextProperty second time - application crashes
    What is the best approach - to continue use separate QDeclarativeEngine's for each QML item or there is another way?
    Symbian & Qt developer. http://vladest.org

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2009
    Posts
    1,024

    Re: lost in contexts

    Hi vladest,
    Yes it's a huge waste of memory.
    Could you please show us our code. If it crash for sure there is a mistake in the code.

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    506

    Re: lost in contexts

    here is c++ initialization of declarative stuff
    qmlengine = new QDeclarativeEngine();
    qmlengine1 = new QDeclarativeEngine();
    poiQmlContext = new QDeclarativeContext(qmlengine->rootContext());

    playerQmlContext = new QDeclarativeContext(qmlengine1->rootContext());

    QDeclarativeComponent componentPOIList(qmlengine, QUrl("qrc:/PoiListSymbian.qml"));
    poiListRootObject = qobject_cast<QDeclarativeItem *>(componentPOIList.create());

    QDeclarativeComponent componentPlayList(qmlengine1, QUrl("qrc:/PlayListSymbian.qml"));
    playListRootObject = componentPlayList.create();

    QDeclarativeComponent componentPlayer(qmlengine1, QUrl("qrc:/PlayerSymbian.qml"));
    playerRootObject = componentPlayer.create();
    then i'm setting my model to qml.
    1st place:
    QDeclarativeContext *p = poiQmlContext->parentContext();
    if (p)
    p->setContextProperty("poiListModel", QVariant::fromValue(poiList));
    2nd place:
    QDeclarativeContext *p = playerQmlContext->parentContext();
    if (p)
    p->setContextProperty("playlistModel", playlistModel);
    if I create only one engine instance and call just 1st place or 2nd place - nothing happens, but if call 2 of them in any order - crash happens in setContextProperty
    Symbian & Qt developer. http://vladest.org

Similar Threads

  1. more than one PDP contexts
    By ijazhasan in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2010-03-25, 12:44
  2. HTTP Connection behaviour when 3G connection is lost (or being lost)
    By TwmD in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2010-01-27, 12:36
  3. Font info for drawing text to bitmap contexts
    By Mete in forum Symbian Media (Closed)
    Replies: 5
    Last Post: 2009-07-09, 06:34
  4. PDP Contexts
    By bilaj in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2003-09-26, 09:47
  5. PDP Contexts
    By bilaj in forum Symbian C++
    Replies: 0
    Last Post: 2003-09-26, 09:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •