Results 1 to 2 of 2

Thread: Total n00b - Qml beginner question set

  1. #1
    Join Date
    Dec 2009
    Qt products

    Default Total n00b - Qml beginner question set

    Hello, I'm trying to learn Qt basics by making small app. I'm interested in simple CRUD Qml quick forms app, but I stumble a lot on little things. I read a lot of documentation (I assume some would argue that lot is a relative term) but I can't figure it out. It would be a lot easier to learn if there would be some complete app and learn by reading it because examples provided with Qt just show what you can do but not what you should do (this part for beginner is crucial, at least this is my opinion). I have several questions considering Qml because I'm stuck there at the moment, I understand that there are multiple answers to them but I'll try to narrow them by decisions of what I would like make. After reading a A Multilayered Architecture for Qt Quick I would like to make multilayer Qt Quick app as the article describes using Qml signals to pass data to c++ backend thinking that there shouldn't be heavy data transfer and for start it's feel natural to me. Ok, the questions:

    1. Should I use these lines of code whenever I want to instantiate some window (subform):
    Qt Code:
    1. QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml"));
    2. QObject *topLevel = engine.rootObjects().value(0);
    3. QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
    To copy to clipboard, switch view to plain text mode 
    or I should import all forms in my mainwindow.qml file and activate them with for example, MenuItem onTriggered:

    2. Should I use ApplicationWindow for all my windows

    3. My intention is to pass data between qml and c++ in form of json objects which I can later on transfer further without conversion, but I didn't found a way how to do this except here but it lacks implementation and in Qt documentation where I understand how to transfer it with QVariant but casting it would be sure nice to see (I'm really tired of guessing).

    Disclaimer: I'm total n00b so please show some mercy .

    P.s. Is it acceptable to post some further questions in this thread or to copy introduction and start another one?

  2. #2
    Join Date
    Jan 2006
    Graz, Austria
    Thanked 1,508 Times in 1,459 Posts
    Qt products
    Qt3 Qt4 Qt5
    Unix/X11 Windows

    Default Re: Total n00b - Qml beginner question set

    Quote Originally Posted by rajko View Post
    After reading a A Multilayered Architecture for Qt Quick I would like to make multilayer Qt Quick app as the article describes using Qml signals to pass data to c++ backend
    Not a very good approach IMHO.
    I think it is a lot better if the application C++ code does not know anything about QML managed elements.
    Instead of passing a QML created object to C++ and connecting signals that might or might not be there, the C++ code should rather provide slots and functions that the QML created code can invoke.
    That way you can easily restructure or replace the UI with the core knowing or caring.


  3. The following user says thank you to anda_skoa for this useful post:

    rajko (4th October 2013)

Similar Threads

  1. n00b mysql and c++/qt question
    By stingray in forum Newbie
    Replies: 3
    Last Post: 16th September 2013, 21:28
  2. Beginner layout question
    By frankiefrank in forum Qwt
    Replies: 1
    Last Post: 10th March 2011, 17:37
  3. SQLite beginner question...
    By theMac in forum Newbie
    Replies: 3
    Last Post: 2nd September 2009, 00:01
  4. Replies: 2
    Last Post: 31st July 2009, 20:30
  5. Beginner C++ question
    By masoroso in forum General Programming
    Replies: 2
    Last Post: 19th April 2006, 14:15


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.