Qt Quick vs. Qt widget

I am new to Qt and do not quite understand the difference between the Qt Quick Project and the Qt Widget project.

I hope to create a program that draws a lattice of hexagons that the user can rotate and move, as well as pan and zoom in and out. Ultimately, it will be a MIDI controller. What type of project would be better for this and why?

I hope this will work on both desktop and mobile platforms.

+59
qt
Dec 24 '11 at 19:04
source share
5 answers

Note: Qt widgets have been replaced with QML widgets; This answer answers the question asked, which is now a strictly historical question about old Qt widgets.

Qt Quick is a declarative smartphone-style user interface with support for the many interesting animated transitions that are common in smartphone apps. Fast is also a good choice for rapid prototype development. Qt Widget is a traditional desktop oriented user interface model.

Currently (prior to Qt5), Qt Quick support for desktop features is missing (but improving). Quick does not have much support for menus, toolbars, dialogs, or other standard desktop behavior, while Widget supports these elements very well.

Do you want your application to look and feel native on desktop and tablet platforms, or do you create a simple application based on your own widget user interface? As Mat said, if Qt Quick supports the features you need, this is likely to be your fastest approach. If you want to create full-featured desktop versions, Qt Widget is probably your best bet.

+32
Jan 31 '12 at 9:25
source share

As someone who professionally develops qt applications, I will choose qml over widgets any day.

Widgets are good for the simplest things, but when you need to create something more interesting, widgets will fall soon.

Qml is just more flexible, you can bind elements wherever you want, instead of using a limited widget layout system. There are almost no flaws depending on the platform, while widgets are full of these errors. And a property binding system makes it so simple to keep your ui in sync with your model.

+28
Nov 07 '15 at 13:48
source share

Qt Fast defaults for QML, a declarative JSON dialect with ECMAscript enabled. With Qt widgets, styles can be made by the designer, and the developer has built-in C ++ encoding.

QML is processed at runtime. Within a framework, everything can work together; differences simply add flexibility when deciding on a software architecture.

+4
Jun 11 '14 at 15:27
source share

First, I think you should start with Widget. Widget UI will help you learn qt quickly if your previous features are about interface things that you would quickly learn quickly.

+4
Oct 15 '14 at 7:45
source share

Note In this answer, “Qt Widgets” refers to the Qt Widgets Application, which can be selected when creating a new Qt application.

This is seven years after the question was first published ... but here my goal is two cents to neutralize any events since then.

Refreshing

language

Qt Quick projects use QML and JavaScript.

Qt Widgets projects use C ++ code (or there also Python in PyQt / PySide).

Performance and Coding

Thus, Qt widgets can be considered low-level compared to Qt Quick. But this implies that in the long run, the Qt Widgets project will work faster and have better performance. Being low-level may be good, since Qt Widgets is more open to the native API (QtCore module, QtStyleSheets, etc.). However, most will prefer Qt Widgets for desktop development.

However, C ++ / Python is much stricter than JS. This may be good, since you have more freedom. (QtCreator does issue warnings, so this should not be a flaw. Just remember to write clean code, not spaghetti.)

Qt Quick serves mobile development (it can still be used in desktop development). It has ready-to-use pop-ups (these draggable sidebars), animations, tab views, quick access controls and regular buttons, sliders and progress bars; all to accelerate the development of mobile applications.

Ui design

Both have custom ui files that work with QtDesigner, providing a high-level interface for customizing layouts, creating interfaces, etc. (In Qt Quick, this is *.ui.qml . In Qt Widgets, this is *.ui .) You can also do this programmatically using QML / JS or C ++ so that .ui not required.

Learning

If you are completely new to programming, I suggest taking a look at Qt Quick first. Personally, I think that Qt Quick has a softer learning curve and it is easier to work with it to complete many projects. IMHO, it’s called “Qt Quick”, and this is due to the fact that usually less code is needed to complete a task or design, which allows you to quickly use any magic that you plan. (Don't look down on QtWidgets; they have some good modules that outperform QtQuick.)

However, if you used to program in C ++ or Python, I would advise you to first look at Qt widgets to get used to their signals/slot mechanism and any modules that they have (e.g. sql , webengine , gui ) along with programming constructs ( e.g. programming a model / view to display tables or data).

Especially with C ++, most non-Qt libraries that use event handling in while -loops, this does not apply to Qt. They use signals and slots .

In the end, even if you mainly use Qt widgets, you might want to take a look at Qt Quick, as it offers a high-level language for work and allows you to configure settings faster. (Especially for mobile development.)

Qt provides examples in abundance for the Qt Quick and Qt Widget projects along with an active forum . So you don’t have to worry about getting help in the long run. (Don't forget StackOverflow!)

Combination

Please note that there is also the option of integrating QML with C ++ . This allows you to use the functionality of Qt Widget and C ++. (For example, QtQuick provides a TreeView but not a TreeModel , the model must be registered in QML from C ++.)

This is also convenient if, say, you need a backend for intensive SQL queries or http / xml queries. Isn't that cool? QML / JS frontend plus C ++ backend. Full stack of Qt'er. :-)

(What I haven't tried yet is the Python backend. I haven't touched PyQt yet ...)

+3
Nov 12 '18 at 11:27
source share



All Articles