where and what to learn to use Qt5?

10.6k views Asked by At

I tried to use Qt5 but I find it very confusing.

I have good knowledge of c++(I would say between intermediate-expert level) but no knowledge of javascript or QML(only basic HTML)

When I go through the examples and tutorials provided with Qt, I find then more to be reference material or like "what's new" stuff for developers who are already using Qt. It shows me random(non systematic) parts of the vast Qt library.

I am currently more interested in using the Qt widget based apps rather than Qt QML based apps.

So this is what I want to ask.

  1. Is QML the main language and C++ just a supporting language? in other words, is learning QML absolutely essential to use QT?

  2. has using Qt for c++ based apps become a de-facto depreciated thing? Is Qt nowadays only used for QML apps?

  3. What do I need to learn to be able to use Qt?

5

There are 5 answers

3
Bowdzone On BEST ANSWER

I have developed a few Qt applications and to this day no knowledge whatsoever about qml. It definitely is the new way because it is newer than what you're after but if everything will be done in qml in Qt 6 or 7 I have no idea.

So to answer your questions:

  1. At the moment I don't see any reason why qml would be required to develop desktop based applications using Qt. This may be different for mobile but I have no experience so far in that

  2. In Qt 5 there is to my knowledge no sign of the old way becoming deprecated. Please correct me if I'm wrong

  3. If you already have a good understand of c++ the main thing you have to learn is the principle of Signals & Slots and the main classes used in desktop applications (QApplication, QMainWindow, QWidget and QObject for instance)

Except that I would suggest downloading & installing Qt (including examples) and running a few of those examples. In Qt 4, there was also a program called qtdemo to which I can't find a link in Qt 5, so I don't know if it still exists. If you can get hold of if there are great examples of what you can do.

0
Jablonski On

Currently there are no many books about Qt5, so main source is official documentation and web, but currently available books:

  • Free book: Qt5 Cadaques, book about QML
  • General Qt book which was updated to Qt 5.3, but in russian: Qt5.3. Professionalnoe programmirovanie na C++

    1. No, I know people who don't use QML at all, but someone else use it more than C++. It really depends on your needs.

    2. C++ is active and for example Digia offers additional not-free modules, like Qt Charts which can be used botj with QML and C++. Also Qt developers always support new C++ standards. For example we have additional features when C++11 or C++14 was released. Hence, it is definitely not a deprecated language.

QML is just a front-end language, it is very good to build beautiful interfaces without headache, but back-end is still C++ code.

0
Jepessen On

There's a lot of Qt tutorial and resources available online. You can simply use a search engine to find what you want.

The most important thing that you must learn ASAP is the concept of signal slots, for two reasons:

  1. It's a fundamental concept that's used extensively in almost all classes.
  2. Even if you know it from other libraries (like boost.signals2), it's implemented in a different way, using connect function and the qmake preprocessor.

It's not complicated at all. You can consider it as a great help in programming, but you must learn how use it (it's easy).

QML is not essential in my opinion. It can be useful for mobile applications but, as of now, I develop desktop-only applications and I develop without problems using only C++ classes.

Qt is a very important framework that's used since years, while QML has appeared only recently. A lot of applications are built with Qt and not QML.

3
cmannett85 On
  1. No. But as new features just aren't being developed for QtWidgets anymore (since 2012), you should not consider it for new development:

Yes, the Qt Widgets module we have in Qt 5 is right now marked as ‘done’, which means we don’t have anybody actively working on new features for the module at this point in time.

As someone who spent many years developing QWidget based applications, I find it vastly easier to develop UIs in QML - it's well worth learning.

  1. No, and I have no idea how you have come to that conclusion. QtQuick is a front-end layer, it has very limited functionality outside of that. In other words, for all but the simplest applications, you will need a C++ (or Python, Haskell, Java, etc.) backend.

  2. Qt is a (huge) framework, you can't start at the 'beginning' and learn everything until you reach the 'end' - that makes no sense. Use the tutorials to get a feel for the API design and how to approach common problems, and read the reference documentation to learn what capabilities it has.

    As for what you need to learn: core internals, MVC, QtQuick, qmake.

1
Marco On

It's going to be hard to find complete and statistically demonstrable information about this, but I am happy to give you my opinion which is based on my 6+ years experience using Qt.

1) No it's not absolutely essential learning QML for using Qt, there are goals that are easier to achieve using QML and others that are easier to achieve in Qt/c++ and there are a few things that simply cannot be done with QML. For example, if you want to create a lightweight mobile cross-platform app based on simple data and where the user experience is far more important then the business logic, QML is probably the best choice. In many other cases Qt/c++ is probably a better option.

2) For some time c++/Qt has been the only real strong cross-platform framework for desktop application, now it's not the case anymore and also desktop applications are gradually loosing popularity, nowadays web applications and mobile applications are preferred by the large public and by managers who decide how to implement applications. In my opinion Desktop applications have become depreciated rather than Qt/c++, for those reasons Digia (the Qt owners) is pushing QML more than the traditional c++ thing, hoping managers will choose that to develop their next application rather than writing a webapp or a native mobile app.

There is one field where Qt is still the de-facto standard and that is the embedded applications market. There are millions of devices like washing machines, cash machines, slot machines, car computers, GPS devices et cetera which are Linux-based and driven by software written totally in Qt/c++.

3) To start learning Qt an initial few days course would be a good idea, but it's not going to be cheap. KDAB is probably a good option, they give courses periodically both in Europe and in the US. If your budget does not allow a course then my suggestion is to look at the examples in the IDE and read (part of) the vast set of tutorials and suggestions you can find online.