16

Nokia has just introduced Qt Quick (build UI declaratively like using CSS/HTML) in the recent beta versions of Qt, check this example page, it can build fancy and modern UI, very cool!

On the opposite, the UI developed by 'traditional Qt' seems to be less fancy (I might be wrong, see disclaimer below).

So my question is, would you use 'Traditional Qt' or 'Qt Quick' for a new desktop program? Why?

My initial thoughts:

'Traditional Qt':

Pros:

  • The overall technologies used be less, thus simpler, if you use PySide, you only code in Python, don't have to mess with the CSS/JS-like things in Qt Quick;

  • It's maturer.

    Cons:

  • Building fancy UI seems to be more difficult?

'Qt Quick':

Pros and cons: the other way around.

Edit: Qt Quick has a downside, correct me if I'm wrong, you can't design Qt Quick UI in a WYSIWYG way, right?

Disclaimer: I'm new to Qt, PySide and Python, just recently has started evaluating using these tech to build desktop programs.

TheDarkKnight
  • 27,181
  • 6
  • 55
  • 85
Edwin Yip
  • 4,089
  • 4
  • 40
  • 86

4 Answers4

8

ave been messing up with qml for my desktop and i personally found this:

  • its easier to create animations than in traditional qt/c++/pyqt (i loved the animations :)
  • I haven't looked through all examples but the code size of qml apps looks smaller than equivalent apps in c++

Problems i have found with qml

  • has poor qml design support- at the moment custom elements dont show up in qml designer.This is a big pain coz ideally i should get a designer to create my ui and i concentrate on the code. Their qml designer still needs some work
  • You are expected to learn javascript since its the "recommended" way of scripting in qt. Javascript is NOT easy as you may expect eg learning python took me a few hours but javascript looks superficially similar to c but some of its concepts are different. Also i wonder if i can protect intellectual property in an app written i just javascript and qml.(correct me if am wrong)
  • native widgets are not available in qml eg it just offers rectangles, etc which you combine to form your own widgets.

This has not stopped me from playing with qml and as it matures, i shall adopt a wait and see attitude. Currently am using qml for part of my ui and c++ for the backend.

Dr Deo
  • 4,650
  • 11
  • 43
  • 73
  • Thank you so much Dr Deo! This info is just what I want - the downsides of QML. Another question, can we use qt for the main GUI of the program and use QML to implement some part of the UI? – Edwin Yip Mar 31 '11 at 15:11
  • Yes. There is a widget called QDeclarativeView which can host QML content. see this site although their example is not ideal. https://idlebox.net/2010/apidocs/qt-everywhere-opensource-4.7.0.zip/qml-integration.html – Dr Deo Apr 01 '11 at 14:28
  • @Edwin: you can also check out the examples folder in Qt under the declarative examples. It shows many well documented ways of using qt including how to use it in main GUI of your program. – Dr Deo Apr 01 '11 at 14:30
  • Thanks Dr Deo. Well documented is a must for a lib. – Edwin Yip Apr 03 '11 at 07:52
  • QML/Qt-Quick lost all my attention at "expected to learn javascript". (and then I disembowelled myself when you said "native widgets are not available"). – Trevor Boyd Smith Sep 16 '11 at 18:27
  • @TrevorBoydSmith in my opinion you do not *need* to know javascript to write a QML/Qt-Quick UI (it might make some things slightly easier) but I think everything you would do with javascript you could find another relatively easy way to do (without much additional pain) using the language the rest of your program is written in. Regarding the lack of "native widgets" or what I would refer to as "desktop widgets" I agree with you - that is a major problem. – actf Aug 29 '13 at 21:49
4

You made one mistake: Qt Quick is not available only in a beta version of Qt. It has been part of the official Qt release since 4.7 (although each minor version significantly improved the features offered by Qt Quick).

Although the "normal" Qt UI (with QWidgets and layouts and all) is older, this doesn't necessarily mean Qt Quick is immature. It is part of the release, after all.

One thing you fail to point out in your pro's and cons is performance: "normal" Qt UI's are prebuillt (for the most part, basically), and Qt Quick UI's rely on runtime interpretation of QML and CSS/HTML as you say. This will mostly not impact application speed on a desktop system, but if you run into performance bottleneck because you're making the UI too fancy, don't say I didn't warn you. Although such a bottleneck probably means you should've gone OpenGL from the beginning.

Qt Quick provides an easy way of building a cool UI (that's the selling point anyway) and will allow you to use cooler effects in an easier way than the old stuff.

rubenvb
  • 74,642
  • 33
  • 187
  • 332
3

If you are using Python then you probably are not concerned about performance. Traditional Qt allows for fancy looks, too via QSS. What Qt Quick gives is a way to easily build a UI (even without tooling support that is being introduced in 4.8) and use scripting to make it work.

You can make fancy UIs with tradtional Qt, too, mainly via QSS and deriving existing widgets. Most Qt examples don't focus on this but that doesn't mean it can't be done. It also probably gives a better overall performance, especially if coded in C++.

I would use traditional Qt because I'm more familiar with it. But this is subjective anyway, so I think your question will be closed.

Tamás Szelei
  • 23,169
  • 18
  • 105
  • 180
  • The part about QSS saves me. Previously I was thinking that I must use QtQuick to have a custom style in my Qt application. After checking QSS in Qt examples, this is my way to go – swdev May 21 '14 at 22:56
  • 1
    @swdev in the three years that passed since, QtQuick has gained hardware acceleration, so the performance part is no longer relevant in my answer. Still, QSS remains usable. – Tamás Szelei May 25 '14 at 10:02
  • What about common widget? Haven't check that out, but does QtQuick already support them, e.g. Button, TextEdit, etc? – swdev May 25 '14 at 22:20
  • 1
    @swdev, yes it does now (for Desktop they are native looking, but not for Android yet). http://qt-project.org/wiki/Qt_Quick_Components – Tamás Szelei May 26 '14 at 11:45
0

I have not so experience on traditional Qt UI systems. But I can give you my experience on QtQuick:

  • UI using QML is more simple.
  • QML enables you to better developing using MVC pattern. It makes View separated from Model. You can load different version of the UI in runtime.
  • QML enables developing advanced UI.
  • It is very performant now (using QSceneGraph technology). It is implemented on multiple UI threads! I am not sure that you can make more performant UI using C++ anymore!
  • UI designers can develop UI simpler than HTML+CSS+Javascript!
  • You can develop your custom UI element by C++ using specific classes.
  • QML is based on OpenGL and in free version of Qt you need to notice that.
  • QML has a specific debugger and profiler. Debugging in UI is so easy.

If you want to develop your app using a standard patten like MVC, QML may be more suitable.
You need to be careful about performance notes.

S.M.Mousavi
  • 5,013
  • 7
  • 44
  • 59