Important: Please read the Qt Code of Conduct -

Understanding the programming languages and activity lifecycle in Qt

  • Hello guys,

    I have a big problem in understanding how to use Qt on mobile platform Android.

    I am a IT student and I am participate a internship in a company.
    They are using Qt for desktop GUI developing.
    My task is to find out how good Qt 5.2 is working with mobile platforms (in this case Android).

    I started two weeks ago to study how Android is working.
    Just wrote an App in Java to figure out how is everything working.
    Therefore I created a own compass app with use of several sensors.

    Last friday I started to have a look on Qt.
    I created a desktop GUI and just programmed some of the examples on the site.

    My major problem is to figure out, which language (c++, qml, javascript, java, ...) I have to use for which use case.
    I just had a look on more than 10 examples on the project site. For almost each example, there is a different "language-pair" in use.

    What I want to do is:
    I want to create a app, which can show a compass, two different forms and maybe something else on a mobile android device. Normally I would create 4 Activitys for that.

    Should I use Qt Widgets, Qt Quick, ... Should I only use c++ or combine it with QML?

    Next thing is, I just had a look on the Android Activity lifecycle.
    If I create a Android App with Qt, do I have the same lifecycle?
    Are there also methods like QActivity::onResume() or something like this?

    I know this is very much text, but it would help me a lot to understand how Qt is working in combination with Android.

    Thanks in advance for some comments!

  • It's not easy answer to your question, so I just write down some comments that may be useful for your to find out how to use Qt.

    == Languages ==
    The main programming language of Qt is C++, and then there is also QML that's a scripting declarative language based on javascript used for creating user interfaces.
    So, you should know C++ and QML (and hence javascript) for using every aspect of Qt.
    Then, because you want to develop on Android platform, you should know also Java. But when developing with Qt, the Java knowledge is needed when you need to customize some specific parts that are made in Java, like the (that's the activity on which the Qt application runs on Android, on Digia Blog there is an article about the anatomy of the Android Qt Apps).

    == QWidgets vs. Qt Quick ==
    Definitely, you must use Qt Quick. For simple reasons:
    the Qt Quick is the future of the way on which Qt will create user interfaces. And they are the best approach of mobile development. And they are very easy to use (once you read "Introduction to Application Development with Qt Quick")

    == Pure Qt Quick vs Hybrid C++/Qt Quick ==
    For simple apps, you can easily do everything with only Qt Quick without writing any single line of C++.
    But, personally, I prefer an hybrid approach where there is a C++ backend that interacts to the user interface made with Qt Quick.
    There are mechanism that are very useful for keeping a good interaction between the UI and the backend.

    Good study and work,

  • Hello Gianluca,

    thanks for your post, it helped me a lot!

    Currently I am using QtQuick for the layout and c++ for the logic.
    QtQuick seems to be very easy for creating layouts.
    (Without one line c++ :P )

Log in to reply