Results 1 to 4 of 4

Thread: How to create C++ objects dynamically and bind with QML UI

  1. #1
    Join Date
    Apr 2013
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default How to create C++ objects dynamically and bind with QML UI

    Hi, I'm a relative beginner with Qt Creator, and have some experience with C++ but I'm new to QML.
    I've been going through the following Dynamic Scene Example:

    http://qt-project.org/doc/qt-4.8/dec...amicscene.html

    I follow how the objects are created dynamically using QML. I want to know is it possible to create
    similar objects dynamically using C++ funtions in Qt Creator, as I cant seem to find any examples
    of this.

    My goal is to extend QML using C++.
    ie. C++ functions -> QML properties.

    Thank you.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to create C++ objects dynamically and bind with QML UI

    What do you mean by "similar objects"?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2013
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to create C++ objects dynamically and bind with QML UI

    I basically mean any generic object that can be open, closed, attached etc. that is created using C++. I'm looking for examples to learn from, and have already found some that creates the objects using QML, such as the Dynamic scene example.

    Thanks.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to create C++ objects dynamically and bind with QML UI

    The dynamic scene example doesn't create any objects in C++. If you want to create qml items in C++ then you can of course do that however I don't understand why you'd want to do that really. Usually we do expose some objects from C++ to the declarative engine however they are usually not qml items or are at least created from QML code using QDeclarativeComponent or similar.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Dynamically allocated objects
    By DmitryNik in forum Newbie
    Replies: 4
    Last Post: 26th September 2011, 12:20
  2. dynamically create QLabels
    By jeffmetal in forum Newbie
    Replies: 5
    Last Post: 19th June 2011, 18:24
  3. QWizard creating objects dynamically
    By afflictedd2 in forum Qt Programming
    Replies: 5
    Last Post: 24th March 2009, 15:43
  4. Replies: 8
    Last Post: 20th April 2007, 00:37
  5. dynamically create folders with QT
    By eleanor in forum Newbie
    Replies: 3
    Last Post: 13th March 2007, 11:40

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.