Results 1 to 3 of 3

Thread: QML with setContextProperty deployment

  1. #1
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default QML with setContextProperty deployment

    Hello,

    I have a Qt Quick app that uses MSVC 2013 64 bit Qt 5.5. Following these instructions http://doc.qt.io/qt-5/windows-deployment.html the app deploys and runs OK. If an object is created in C++ and setContextProperty is used the app runs OK in Qt Creator. But when deployed no window is shown and it has to be exited by ending it in Windows task manager. What is needed to deploy with setContextProperty?

    Qt Code:
    1. QQmlEngine engine;
    2.  
    3. MyObject myObject;
    4. myObject.initialize();
    5.  
    6. engine.rootContext()->setContextProperty("myObject", &myObject);
    7.  
    8. QQmlComponent component(&engine, QUrl(QStringLiteral("qrc:/main.qml")));
    9. QObject *context = component.create();
    10.  
    11. return app.exec();
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QML with setContextProperty deployment

    Hmm, are you sure this is related to the context property and not just missing dependency for, e.g. QML or QtQuick?=
    I.e. have you tried with an empty window or a window that has content but just doesn't depend on the context object?

    Cheers,
    _

  3. #3
    Join Date
    Nov 2015
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QML with setContextProperty deployment

    Thanks for the feedback, this was a missing dependency and not directly from setContextProperty.

    Thanks again

Similar Threads

  1. Replies: 3
    Last Post: 3rd March 2015, 17:53
  2. dll deployment
    By freiza in forum Newbie
    Replies: 11
    Last Post: 2nd March 2015, 20:11
  3. A different deployment technique QT. Is it the right way of deployment?
    By Tarun in forum Installation and Deployment
    Replies: 1
    Last Post: 15th February 2010, 14:45
  4. Qt 4.3: Deployment on MAC
    By Angelo Moriconi in forum Installation and Deployment
    Replies: 0
    Last Post: 23rd July 2007, 12:03
  5. deployment of a dll using qt
    By mandal in forum Installation and Deployment
    Replies: 1
    Last Post: 14th March 2007, 15:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.