Results 1 to 8 of 8

Thread: Load a portion of UI from a plugin QML (dynamic GUI) and expose C++ models to it

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    Jun 2014
    Posts
    5
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default Re: Load a portion of UI from a plugin QML (dynamic GUI) and expose C++ models to it

    Quote Originally Posted by anda_skoa View Post
    I meant qmlRegisterSingletonType()
    However, there might be another option that is closer to what you tried.
    I assume you are using QQmlComponent to create the UI. You can pass a context to its create method.
    _
    I'm using the following to create the main UI (i.e. loading main.qml). It is in this view that I want to load the plugins QML components:

    Qt Code:
    1. QGuiApplication app(argc, argv);
    2. QQuickView viewer;
    3.  
    4. viewer.setSource(QUrl("qrc:///..."));
    5. viewer.showExpanded();
    6. return app.exec();
    To copy to clipboard, switch view to plain text mode 

    Also, I found this thread that seems pertinent to my problem. However, I cannot fully comprehend it. Specifically, what are window1, window2 & window3 in the given solution.

    How do I create my main UI using QQmlComponent and later add the QQmlComponent created using the method you specify to the main UI's QQmlComponent? I found a possible implementation here. But when I run it, I get a crash because:

    Qt Code:
    1. QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
    To copy to clipboard, switch view to plain text mode 

    evaluates to window = NULL
    Last edited by gmanish; 3rd June 2014 at 20:47.

Similar Threads

  1. Link to plugin as dynamic lib in another plugin
    By alizadeh91 in forum Installation and Deployment
    Replies: 5
    Last Post: 16th December 2012, 22:16
  2. Replies: 1
    Last Post: 23rd June 2011, 23:09
  3. Dynamic load QT Plugin - symbol lookup error
    By qlands in forum Qt Programming
    Replies: 4
    Last Post: 2nd May 2010, 19:37
  4. Load objects from dynamic library
    By Trok in forum Qt Programming
    Replies: 10
    Last Post: 17th July 2009, 20:04

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.