本記事は「Qt for Android Automotive 6.5.2 is released」の抄訳です。
Android Automotive 6.5.2 の最新パッチリリースがリリースされました。このリリースは Qt LTS 6.5.2 をベースとしており、Qt 6.5.1 リリースに加え、290 のバグ修正、セキュリティアップデート、その他の改善が加えられています。
既存の Qt for Android Automotive ユーザの方は、以前の 6.2.x, 6.3.x, 6.4.x, 6.5 リリースからのアップグレードをお勧めします。プロジェクトが 5.15.x をベースにしている場合は、Qt 6 への移行ガイドに従ってください。Qt for Android Automotive の評価にご興味のある方は、営業担当者までご連絡ください。
Qt for Android Automotive の技術情報については、Qt for Android Automotive の技術資料をご参照ください。
Hi Andy,
great post. I really would like to to give QtQuick a try. For my application I would like to implement some kind of graphical programming like it is known from LabVIEW. That means, there are processing nodes (rectangles) that are connected by data wires (lines or splines). The use adds nodes, connects to nodes via wires and drags nodes around with the mouse.
Do you thing, this is possible with QtQuick? I have an Idea how to do it with QGV but not how to do it with QtQuick.
Yes this is achievable quite easily using QtQuick2.
Hi Uwe,
I would really like to see something like this for Machinekit (http://www.machinekit.io/)), I have already QtQuick UIs: https://github.com/machinek.... If you are going to implement this please let me know.
Best regards,
Hi Alexander,
I have no glue how to implement this in QtQuick - I think I have to learn more QML and QtQuick before. The interesting thing is, that the new QtCreator comes with Qt SCXML and State Chart Support. And the state chart editor is quite close to the GUI I would like to implement. States connected via transitions - that is almost the same like nodes and data flow lines. And guess what the QtCreator team used to implement this editor:
QGraphicsView.
>And guess what the QtCreator team used to implement this editor: QGraphicsView.
This is a reasonable decision IMHO, QtQuick still far from ideal for that kind of applications after so many years.
QtQuick is decent for consumer apps, but never a nice tool for complicated, high performance industry products(ex : CAD tool), even Qt team know the truth and pick QGraphicsView for the new editor.
Thanks to the great works of those brilliant programmers put into QWidgets, QGraphicsView, even Qt company stop the development, they are still unbeatable if you are using c++, but this may change in the future.
Qt company asked us ditch QWidgets, QGraphicsView and embrace qml before it can fully replace QWidgets and QGraphicsView, this do not make sense at all, it is like talking "even qml is not a good tool for many desktop apps, you should use it instead of QWidgets and QGraphicsView, because they will become more and more obsolete in the future".
You stop the development of QWidgets and QGraphicsView, yet never give us a decent heir of them. qml and QtQuick only good for consumer based app, fail to replace QWidgets, QGraphicsView on desktop apps we mentioned above.
So what are you trying to do? Make QtQuick be a decent heir of QWidgets, QGraphicsView in the future, or turn Qt into a library only good at mobile development?
Very nice post!
I am happy to hear that a policy change of private QML APIs is at least being considered.
Despite really liking QML and Qt Quick in general, it's one of my biggest gripes.
When I make applications using Qt Quick I want to keep my user interfaces completely declarative and put all the imperative parts and logic in C++.
A completely public C++ Qt Quick API would help a lot in this.
What about memory use? From what little I know of QML, almost very primitive like Rectangle inherits from QObject, and usually with QML your objects are compound objects with Text as well. To use QML instead of QGraphicsView for a application that requires lots and lots of graphic items seems to spell out a huge jump in memory usage for QML.
You are correct. In Qt Quick, any item you have in your scene is at least one QObject, so at the very least items in QML are closer to QGraphicsObject than QGraphicsItem. If you try to create the 40000 Chips demo by creating 40000 QML Components (each with many sub-components), you better come prepared with a lot of RAM! Normally you would avoid trying to create so many items at once in Qt Quick, by only creating items that were visible. But there are still cases where you need to have large numbers of items visible at once. The key is to have a Single (or few) QML items that have many QSGNode children. QSGNode's are much closer to QGraphicsItem's in the sense that they only carry a bit of state data, and don't inherit from QObject. That is an over-simplified explanation, so I plan to write another post expanding on these things soon.
How to optimize memory usage with QML would be an excellent post. And an article on Qt Widgets and modern C++ would be nice too. I think most people using Qt widgets are still using C++98 with new and delete, but these kind of memory controls have been depreciated since C++14.
We are using QGraphicsView heavily in our application and also offer Python scripting to script your own graphics view. So moving to QML would mean to say to all the customers,
forget your old scripts, do something new! And it works almost as good as the old things... But you can't embedd widgets anymore.... But you can learn how to use QuickWidgets1 no, wait, QuickWidgets2, or something that will come next year and will be around for a year or two...
Hm, to me this is too much change in a short time. I understand that you have to move forward and that some architectures can't be fixed, but it is not so easy to tell everybody to just don't use working APIs anymore because people have large working applications.
Sorry that I sound like an old person who says everthing was better in the old times,
but I really think that you should focus on longterm APIs and not things that get introduced and shortly afterwards they are deprecated again and people who used them are stuck at an old Qt version.
Thanks for your feedback. This is balance we have to strike in many different places in Qt. Qt has been around for a long time, and has picked up a lot of different ways to do the same things. In general we only deprecate things that have been sufficiently replaced, and even then keep the old API around for quite some time. In the case of Graphics View it has been considered done and stable since Qt 4.8. The API will exist for all of the Qt 5 series, and will almost certainly be around for Qt 6 as well (though maybe in a Compatibility module, but thats just my speculation). If an API is currently working for you and your customers, there is no reason to change for the sake of the "new and shiny".
Guys, I'm with Qt from 2012 year and I love Qt absolutely. Every day I'm trying to spread Qt everywhere it is suitable. But what are you doing? Qt is C++ Framework. C++ needs Qt and Qt needs C++. Qt is not JS framework and not scripts toolbox. Why do you trying to move from QWidgets?
In section "But I don't want to write QML or Javascript!" the only two argument you used, substantially, is "Give QML a try" and "Writing only C++ can be challenge". And both of them is your opinion (I mean your company). It can be challenge because of your decisions, not because we need so much QML and it is so cool. It's because company has a plan to move from QWidgets to QML, nothing else. Stop that, please. We need C++, not one more script. Enough scripts in the World.
Qt is still a C++ framework and QtWidgets has not gone anywhere. We are not trying to replace QWidgets with QML. Qt Quick and QML enables the creation of a different kind of UI that QWidget could not support. Using QML in Qt Quick is similar to using UI files (XML) in QWidgets. Both are creating a hierarchy of C++ objects. It just so happens that QML also enables in-line Javascript code (which can be both a good and bad thing). I did not feel like I was advocating not using C++ in this article. Please do not take away the impression that we are trying to move away from being a C++ framework because that is not true. If anything I'm suggesting that we should do more to make the Scenegraph API usable from C++.
One specific question:
When I don't understand a certain behavior in QGraphicsView, I add some breakpoints and step through the Qt code. I follow the state changes, paint calls, etc. and usually see what's going on.
How would I do that in QML?
In QML there is an additional debugger. So when you debug your application you have both the qml debugger and the c++ debugger running at the same time. In QML, since most of the structure is declarative it doesn't make sense to set breakpoints, rather the QML debugger's view updates in realtime to show you the current state of the tree. If you have in-line javascript code this is imperative, so you can set breakpoints just as in C++. These are two different worlds though so it does become more challenging to move from one to the other in the same debugging session. If you are implementing items in C++ (QQuickItem and QObject subclasses), then you would just debug as you are now. So for example if when you clicked a button in your UI, it would call a Slot on your custom object. Well then that is in the C++ side, and you would have a break point there. It will depend on the issue you are trying to solve which debugger you will care more about.
Do anyone use qml to create big apps? qml is a neat tool for "mobile like" apps, I use qml to create some small apps for in house use(experiments). Conclusion is I always find QWidget, QGraphicsView are better tools for large, industrial products.
1 : it is more mature, more tutorials, examples, easier to create complicated apps. Mobile screen is not suit for that kind of apps but favor more on simple, fancy UI, which makes qml a decent choices
2 : compile time checking is very essential for medium/large size projects, type safety help you avoid lots of subtle bugs.
3 : it is easier to control resources by pure c++. Why should I scratch my head to optimize 40000 chips on screen by qml when QGraphicsView solve this problem perfectly?
4 : I can control scope with much better granularity by c++. It is hard to imagine how could I keep things maintainable with qml.
qml advertise so many years, yet it still do not looks like a decent tool for complicated app compare with QWidget/QGraphicsView. What is the future of Qt?
a : Make qml easier to replicate all of the things done by QWidget?
b : make qml as a neat tool for fancy small app while maintain QWidget?
ps : allow users to use QtQuick by pure c++ do not mean QtQuick become better candidate than QWidget/QGraphicsView if it still lacks those features QWidget/QGraphicsView offer.
I really like QML and Qt Quick. The declarative nature of the language, the data bindings, the animation system. This is all very convenient for quickly building fluid, animated UIs, which are a pleasure to look at. I really like having tools like this at my disposal. Modern, touch-optimized, fluid UI is a major selling point, because looks sell better than anything else. It also fits the mobile and automotive segments. It is obvious the Qt Company wants to pivot into these segments and therefore is pushing QML hard.
But there is still a big use case for QWidgets and QGraphicsView in desktop applications, CAD-like programs and industrial GUIs. These applications simply cannot and will not be replaced with fingerpainting consumer-grade UIs. QML is simply not a good fit here for all the reasons already mentioned in this discussion (and some more). Yes, a lot of issues can be worked around. But then you may come to a point when that is simply too much to work around and you ask yourself "why bother?", when QWidgets worked well for you.
As a developer who relies on QWidgets & QGV heavily, it is distressing to hear that the Qt Company might be obsoleting this technology. Especially when there is no good alternative out there. Please, don't do that and don't treat QWidgets and QGraphicsView as second-class citizens. Thanks.
Thank you everyone for the comments so far. We do read each comment and there have already been some interesting discussions as a result.
@Qt I uploaded on Github https://github.com/FabriceS... a demo application that implements shaders for theses vector graphic primitives:
A shader for dashed polyline is also known but not yet implemented in this demo. For example, I implemented polyline curve based on geometry shader from tablet input in another application.
Theses experiments are impressive but vector graphic on OpenGL is not an easy task. There are issues. But the ideas beyond QML scene are right, we have to optimize the opengl pipeline to achieve good performances.
I think developers need concrete examples to know if a technology is mature enough to use it for real applications. On Qt4 things seems clear despite there are many flaws, but in Qt5 it is more confusing since it is steel a new approach.
Very interesting piece of code, did you have a test with a pure QML interface with one QtQuick item per arrow or marker to allow selection and interactions and no application level AA ? Without a space partitioning and LOD algorithm like in QGW, I am not sure it is possible to maintain a reasonable FPS rate (see "crashtest" of QuickGeoGL: http://www.destrat.io/quick...)
There are more than just simple UI widgets in computer graphics. We have extensive customized QGraphicsItems for our graphical editor product. On top of custom items, calling through to JavaScript and back to C++ is not optimal since speed is one of the very top requirements for it.
Your blog post was a little bit late for the QtCreator team. They just implemented Qt SCXML and State Chart Support in Qt Creator. I was shocked to see that they used QGraphicsView for the graphical state machine editor. This could have been such a great example of how to use QtQuick in a professional product instead of QGraphicsView.
What is your opinion? Would it have been easier and better to implement the State Chart Editor with QtQuick?
I agree with a lot of the anti-QtQuick opinions expressed here. Please understand that software has an extremely long life cycle, much longer than most people think. I'm currently replacing a 20-year-old GUI that was written in C with straight X11 calls; the rest of the application is actually fairly modern C++ by now. I was evaluating QT5 with QGraphicsView to replace the GUI portion, and it looks very appropriate and useful. Then I came across this page. I have never heard of QtQuick until now and after reading as much as I can find about it -- Do Not Want. Why make your own markup language for this stuff when the C++ classes already work? I can be fairly sure that if I use QGraphicsView, others will understand the C++ code 20 years from now even if I have to keep a by-then ancient version of QT around to use it. I can't be as sure that people will know what to do with this QtQuick thing. The selling point of "oh you can do things with QtQuick that you can't do with QGraphicsView" rings hollow when I never intend on doing any JavaScripty type stuff with the application in the first place.
I have spent quite some time in the last weeks evaluating Qt Quick / QML as a possible choice for new UIs, or even as a possible replacement for existing UIs (which are currently done in Widgets or GraphicsView). That evaluation gave me a pretty clear picture about where QML is usefule, and where it is not:
QML is useful in UIs which are designed, i.e. you know at design time how they are supposed to look and behave. Examples: An app for chatting; A calculator; A typical dialog; A file manager GraphicsView is useful in UIs where the user creates the design at runtime. Examples: An application for creating presentations (e.g. PowerPoint), A vector graphic drawing application, A layout designer for electrical components
Maybe GraphicsView has been misused in the past for things it was not really great at, and it makes sense to replace it with QML in those cases. But it really shines in the examples I gave above.
Still....the QPainter stack is getting old and slowing things down.
So my hopes are for step-by-step extensions on the Qt Quick / SceneGraph level, so that one day, I can replace GraphicsView with C++/Qt Quick/SceneGraph, and easily integrate the result into a QML scene
Well, I got a little scared with the title of this article. Because I'm building some widgets of my application with QGraphicsView.
However this made me remember that a friend of mine said that Qt is slowly giving preference to Qml instead of QWidgets, so this change from Graphics View to QtQuick should not be a surprise. But maybe he can be wrong. However my adventures with Qml wasn't the most pleasant ones, and for now I'm still giving preference to QWidgets.
I enjoyed your post and I'm looking forward the next ones!
QtQuick is cool and nice (I like it a lot). But not being able to print (as simple) as QWidgets and QGraphicsScene is a real issue. And yes - having Rectangle as the only shape is annoying (but no big issue).
Regarding printing Qt Quick scenes, this is something I'm hoping can be fixed now that we have the software adaptation as part of Qt Quick. The plumbing is not there yet, but it should be possible to render a QML scene via QPainter to a QPrinter paint device with the software adaptation. If enough customers/users scream loud enough then we can make it happen ;-)
WHAAAAAAA!!!! (I'm on startup plan - loud enough? ;-) )
YEEEEAAAAAAAH (screaming as loud as possible...) we need this :)
Vote here: https://bugreports.qt.io/br...
"There was a time when the Qt Graphics View Framework was seen as the solution to create modern user interfaces with Qt."
Yes... That's sort of true. I've always felt that that was an abuse of QGraphicsView, though, and a big mistake back in the Nokia days. When QGraphicsView was being developed, Lars suggested to me that it would be really good to use it to render the documents in KOffice. It was originally a canvas implementation, replacing the old Qt3 QCanvas class. You'd use it to render the document area of a word processor, mapping application or spreadsheet, not to create a finger-friendly gui.
Me and my team are heavily dependent on QGraphicsView, and have a huge codebase building on it. There are several reasons for that:
1) For various reasons, we still work with Qt 4 exclusively.
2) Our only performance-critical use cases run on a custom embedded hardware. I have my doubt that QML would improve anything there (no GPU, no FPU)
3) Our whole toolchain is tuned for C++. For example, our code is checked by static code analysis. Are such tools even available for QML?
4) As mentioned, there is a huge codebase that would need to be changed. The benefits of spending several human-months (given our level of customization maybe beyond a human-year) to exchange a proven system for a new one needs to be so clear that also non-technical decision-makers can get behind it. Currently, I see no such clear advantage. Rather the opposite: Because we have very long-term support on our products, replacing GraphicsView would mean that we have to maintain two very different codebases - with all the extra cost associated with it.
In any case, I would probably need to spend weeks toying around with QML to just find how the various customizations we currently do in GraphicsView would be replicable.
Thanks for your feedback Robert! This is exactly the kind of perspectives I'm looking for. I understand why Qt Quick might not be the right tool for the job in your case. I mentioned it in my talk, but not in this article, but if Graphics View is working well for you now, you should feel under no pressure to change to Qt Quick. The take-away you should have as someone successfully using Graphics View now is that things will continue to work as they do now, but are not likely to improve. If there are regressions however you should put our feet to the flames ;-)
Nice post, I'm glad to see this subject discussed on the blog. Personally, I think the old QGV demos and examples were more inspiring for my use-cases (desktop, maps or CAD oriented). Perhaps porting (or rethinking) a few of them (10k chips, diagramscene, ...) would help to demonstrate the advantages of QSG and give insights on design choices or migrating from QGV apps?
I agree with you about the demos. As part of the research for this article I explored how it would be possible to implement a performant Chips demo with Qt Quick. I am thinking writing an additional post just about this process when I get time.
That'd be awesome
I agree with this.
I developed a QGraphicsView CAD (draft) interface in FreeCAD, which potentially could have models with 100s of lines of different types, each need to be selectable.
QtQuick2 is great for interfaces, but I am yet to see good examples that are relevant to industrial/engineering applications. Most examples provided by Qt are mobile interfaces/games, that don't lend itself with the type of industrial work available.
The other issue is subclassing or the lack of public c++ classes that are available for QtQuick2, which surprisingly are available in the new Qt3D module which I like. The kind of ambiguity with prototype language in JavaScript/QML I find is difficult to lend towards a clean program structure. More structured examples/good practice guides would help in this area and encourage it's use.
Yes, GraphicsView is very useful in CAD oriented development. There is little open source alternatives that is as mature as QGraphicsView. When we ported our codebase from Qt3 to Qt4, GraphicsView seemed to be a perfect successor of our own graphics layer. Luckiy we decided to keep the old graphics layer while kept an eye on Qt's development. Now we are considering rewriting it using JS in browser. SceneGraph is good. But unfortunately SceneGraph can't be used directly in C++.