Nominate our 2022 Qt Champions!

QML and ~(#include "file.h")

  • I just started reading about QML, it looks fantastic! However, I have a question that I feel is naive, but concerning at the same time.
    As we store code in 'h' files when programming in C++ to later be recall, I wonder if QML provides the same concept.


  • Lifetime Qt Champion

    It does provide the concept of include for reuse objects in projects

    If that what yo u mean?

  • Thanks for the reply.
    I noticed in the examples in the web page link provided, that the only 'import' are from 'QtQuick 1.0', however, programs are normally structured randomly, for example, the main / default developing folder might be 'C:\qt\app', but the QT libraries are in in E:\dev\c++\Qt\QML\myQmlLib', D:\dev\c++\Qt\QML\Tim_Berners-LeeQmlLib' and E:\dev\c++\Qt\QML\Monica_BelluccisQmlLib'.
    How do I import this libraries which are in 'qml' files?
    Thanks in advance.

  • Lifetime Qt Champion

    i think
    you use a file to tell where to find stuff not in the project folder

    But im not sure if there is not a faster way.

  • Needs to be said, it is a very unconventional, to say the least, specially for a XML platform that will interface with C++. I would have expected QML to have an API that has more in common with C++ than with JavaScript. After all, C++ is one major reason in choosing Qt.
    Nonetheless, this unconventionality does not diminish, in any way, the facilities and niceness of Qt. I am loving it and I'd like to continue learning more about Qt and QML.

  • Lifetime Qt Champion

    Well you can fully use Qt Widgets
    and never use QML at all. its two very different
    technologies and target different use cases.
    I think they wanted it to be like java script.

Log in to reply