I'm confused with QML, QtQuick 1.0 and QtQuick 2.0. What's the difference between them?
I use QtCreator 2.8.1 based on Qt 5.1.1. I want to develop a desktop program, which technology should I use?
QML is the name of the language (just like C++, which is another language...)
QtQuick is a toolkit for QML, allowing to develop graphical interface in QML language (there are other toolkits for QML, some are graphical like Sailfish Silica or BlackBerry Cascade, and some are non-graphical like QBS which is a replacement for QMake/CMake/make...)
QtQuick 1.x was Qt4.x-based and used the QPainter/QGraphicsView API to draw the scene.
QtQuick 2.X was introduced with Qt5.0, based on Scene Graph, an OpenGLES2 abstraction layer, highly optimized.
With Qt5.1, Scene Graph was enhanced to use multithreading (QtQuick 2.1)
With Qt5.2, Scene Graph is yet a lot more optimized to reduce CPU/GPU calls and memory usage
QML engine was based on JsCore (JS engine of Webkit) in Qt4.x and was rebased on V8 (JS engine of Google Chrome) with 5.0 but this disallows to use it on mobiles and especially on iOS, so Qt5.2 introduced a new QML engine, named V4VM, created by/for Qt guys.
There are also the QtQuick Controls, which is basically a set of native-looking widgets, based on QtQuick. It was originally meant for desktop, but Qt 5.4 introduced a native L&F for Android, based on the holo theme. A material theme, as well as an iOS theme, are in development but not available as of current Qt release (5.5). Some controls were Enterprise only, but in Qt5.5 they got renamed as Extras, and they are now available for all licenses. Another development is undergoing, named QtQuickControls 2, which is a full rewrite of Controls, to gain better performance, aimed for light embedded UIs, it should at Tech Preview stage in Qt 5.6.
From Qt5.5, there is a new module named QtQuick3D, which gives ability to create 3D apps/games using QML language. It doesn't use SceneGraph which is too 2D/2.4D oriented. A new engine is named FrameGraph for this use.
If you develop modern apps you should use Qt5.x + QML 2.x + QtQuick 2.x, to touch the most vast userbase possible.
With Qt, in general, always follow the updates because they add more features, more perfomances and more platforms.
EDIT: Please refer to #TheBootroo for a better answer
Although my answer was accepted by the OP, I want to revise (or even) remove my answer.
My answer was based on personal experiences with respect to Qt 5.2 in 2013 some of which is no longer valid today:
QML is Qt Meta Language or Qt Modelling Language is a user interface markup language.
QtQuick (both QtQuick 1.x and QtQuick 2.x) uses QML as a declarative language for designing user interface–centric applications.
Back at Qt 5.2 when you built a Qt Quick Application a significant question was whether the app was QtQuick 1.x or a QtQuick 2.x. Not only did this affect the components that were available, but, it altered how the application was rendered.
Back in 2013:
QtQuick 1.x applications was often chosen if you had to target older operating systems (e.g. Windows XP) or older hardware (e.g. OLPC) because the QML UI components such as Buttons were rendered by components native to your OS. However, this meant you were targeting a lowest common denominator set of UI components and that your UI experience may vary from platform to platform.
QtQuick 2.x application was chosen for a more consistent cross platform look, but, it required that your platform implemented OpenGLES sufficiently else, your application may fail to load. This, unfortunately, restricted your application to only the newest computer and devices that implemented OpenGLES.
When I wrote my original answer, this lead me to recommend QtQuick 1.x in some scenarios over QtQuick 2.x.
However, since then, Qt 5+ now allows you to target ANGLE on Windows which brings high performance OpenGL compatibility to Windows desktops by translating calls to Direct3D, which has much better driver support.
Related
I’m working now on some project built on Qt 5.2.1. The project makes some basic rendering (using QPixmap, GraphicsScene, etc). The goal is to switch this mechanism to OpenGL as quickly as possible. In addition we plan to move the whole project to Qt 5.10.
Is there some benefit first moving to Qt 5.10 and only then switch to OpenGL over first switching to OpenGL and afterwards move to Qt 5.10?
Is there possibility of some unexpected difficulties if we first switch to OpenGL (on Qt 5.2.1) and only then upgrading to Qt 5.10 (some features got deprecated or some new nice-to-use features appear)?
My experience with OpenGL on Qt is it being full of both old and new bugs, poor integration capabilities, poor platform support (Intel=NOPE) and no error handling of Qt-internals (e.g. context creation). At least of you use the built-in OpenGL-widgets.
That said there is much development going on right now of the Qt-OpenGL support, judging from which Qt-version certain OpenGL related features I have found in he manual. If you must use Qt-OpenGL, I would assume you get most features and few(er) bugs jumping onto latest and greatest.
I have a Qt application that draws using Open GL. At some point I'm using a QQuickWindow associated to a QQuickRenderControl to draw a QML scene into a texture to later compose it in the final image.
Now, I'm considering porting OpenGL to Vulkan and I'm not sure if it is possible to do the same with this QML layer.
Reading Qt docs I found that
QQuickWindow uses a scene graph on top of OpenGL to render.
Do you think it is possible to port it to Vulkan? Perhaps overriding QQuickWindow and QQuickRenderControl? I'm not a Qt expert so perhaps someone can give me a better insight of the problem.
As of June 2019 and Qt 5.13, Qt Quick 2 supports the following backends:
OpenGL 2.0
OpenGL ES 2.0
Direct3D 12 (support is still experimental)
OpenVG
Software rendering
However, only OpenGL and OpenGL ES are fully functional. For instance some effects (like particles) do not work with the other banckends.
For more information about how to select a backend and what are the limitations of each backend I suggest to read the documentation: https://doc.qt.io/qt-5/qtquick-visualcanvas-adaptations.html
Regarding Vulkan specifically, Qt has added support to it since Qt 5.10.
However, the support is still very limited and does not cover Qt Quick.
Change will come in the future; quoting an email from Qt development mailing list:
A very early preview of Qt Quick for Vulkan, Metal, and D3D11 may come already in Qt 5.14, then evolve in 5.15 and beyond, with 6.0 as its final destination.
So rendering Qt Quick with Vulkan should be possible when Qt 6 will be out. The planned release date for Qt 6 is currently November 2020. In the mean time technical previews might be available starting with Qt 5.14.
I would not be too optimistic for anything before Qt 6 as (1) it will just be technical previews and (2) as far as I know, current official Qt binaries are not linked with Vulkan at all and you need to build Qt from source if you want to use Vulkan.
Are there any functional differences between QWebView and QWebEngineView? If I understand correctly, QWebView is webkit, while QWebEngineView is blink. Are there any differences to the programmer? Does one offer more customization of look & feel over the other?
I would give QtWebEngine a try. It is replacing QtWebKit for a reason.
If you control the HTML that is getting rendered, then it probably doesn't hurt to use QWebKit. Just make sure you test your pages beforehand.
QWebView uses WebKit as the backend.
http://doc.qt.io/qt-5/qwebview.html#details
QWebEngineView uses Chromium as the backend.
http://doc.qt.io/qt-5/qwebengineview.html#details
WebKit is what is used in Konqueror on Linux and Rekonq. Its not bad, but its not as robust across general (and often imperfect) web pages/html in my opinion.
Chromium is a much newer, faster and more robust engine.
I don't know all the technical details specifically, but QWebEngine is a big step in the right direction. I've found this mostly from my own experimenting and empirical usage.
To give WebKit a decent try, look at this project and try a variety of pages:
http://qtweb.net/
https://github.com/magist3r/QtWeb
Here is some more info about QtWebEngine v QtWebKit
http://wiki.qt.io/QtWebEngine
http://en.wikipedia.org/wiki/WebKit
http://wiki.qt.io/QtWebKit
As for me I can't see some very important features in QWebEngineView. First of all you can't access to all frames on page, and you can't run JS in all frames. The next one is that you cant use QNetworkAccessManager for control view underline layer. So for now I can't see any solutions for some issues, like this How to disable sound on flashplayer in my custom application? . I want to believe that it is possible to solve it in some way, becouse QWebEngineView works much faster and seems like it have no (or less) memory leak issues then QWebView.
Framework: WebKit vs WebEngine
There used to be Qt WebKit since 2007 up to version 3. According to this Qt blog and here It is replaced by new Chromium-based web engine which is Qt WebEngine. According to the link Qt WebKit works fine right now, and will continue to do so in the years to come but if you want to have all the latest and greatest HTML5 features available for your application or device, you should consider moving over to Qt WebEngine.
As this blog says: Qt 5.4 also still contains the older Qt WebKit module. Qt WebKit is still supported, but as of Qt 5.4 we consider it done, so no new functionality will be added to it. We are also planning to deprecate Qt WebKit in future releases, as the new Qt WebEngine provides what is needed. In
My Decision: I prefer to go with the latest QtWebEngine specially when I am in the initial stage. If I hit the wall then maybe I revert to the Qt WebKit.
QML: WebView vs WebEngineView.
For having a browser item in QML there are two items WebView and WebEngineView.
WebView with the same name has been defined in both WebKit and WebEngine. Documentation for WebView in WebKit is here. It should have the import QtWebKit 3.0.
For using the WebView bound to WebEngine which is mentioned in this documentation, we need to have this import: import QtWebView 1.0. But we will highly likely face an error #5 and #6 which the solutions to debug is states in the link.
I will use the latter WebView i.e the one which is provided by WebEngine. The proof that it is related to WebEngnie is the debug solution to error #5 and #6. From now on, WebView refers to the one offered by WebEngine in this document.
As this blog says: In Qt 5.4, Qt WebView is provided which offers a more limited API to embed the web browser that is native to the underlying operating system for use cases where the full Qt WebEngine isn’t needed, or where it can’t be used because of restrictions coming from the underlying OS. In Qt 5.4, the Qt WebView module supports iOS and Android. It supports embedding the native web engines of the underlying operating system into Qt, and is currently available for Android and iOS. Because of this, Qt WebView also gives a convenient light-weight solution for simple web document integration.
WebEngineView allows QML applications to render regions of dynamic web content. A WebEngineView component may share the screen with other QML components or encompass the full screen as specified within the QML application.It is my choice in applications which are not going to be executed in iOS and Android.
Note: It is According to this blog QtWebView will fall back to using QtWebEngine when possible. In the meantime that they are making more platforms possible with WebView. It is also mentioned as a reply to a QT-Bug that: While we don't have native WebView implementations for the OS X, Window etc. we can fallback to use QtWebEngine
My Decision: WebEngineView in non Android and iOS applications.
Is OpenGL mandatory in order to run a Qt application made of QML pages ?
Well, an implementation of OpenGL ES 2 is mandatory for Qt Quick 2, but that doesn't mean you need to use native OpenGL. On Windows you really should be using ANGLE, since on many Windows systems the installed OpenGL is either too old or broken.
Yes, with Qt Quick 2.0 OpenGL is a mandatory requirement.
I am currently looking at using PySide for mobile app development. I've done a few tutorials for creating desktop applications using Pyside and loving it. I understand PySide/PyQt is a port or mapping for Qt, and is usualy behind a little bit with Qt as developers of PySide/PyQt have to keep up with whatever happens in Qt.
I particularly want to develop for Android, BlackBerry and iOS. I also understand that Qt recently added support for Windows 8, as well as the more recent BlackBerry 10 OS.
My question: How well versed is PySide/PyQt in its current state with cross mobile application development.
Does it achieve mobile development by means of the WebKit component, allowing the use of everyday HTML, CSS and JavaScript?
Would it be a better option to consider PyQt for mobile app development, or PySide?
I think its not realistic to think you can use PySide/PyQt and Python in order to make one application suitable for all those platforms.
First of all the platform you want to develop for should support your programming language (Python) as well as the graphical framework (Qt) in order to make it work. This is mostly achieved by third party developers. If Python runs on your mobile operating system this does not say you can start developing and vice versa.
Mobile development is often done with QML (Qt Modeling Language). This allows you to make really cool and fancy interfaces on many platforms. You can connect it to your own Python code to make a real working application.
At this moment Qt is working on support for mobile devices. Most mobile operating systems like iOS and Windows Phone are not supported yet for the combination Python/Qt and mostly the support for working projects is not really big in comparison to the preferred languages of the operating systems.
Here is a list of mobile OS's which support the combination Python/Qt
Link to projects if there is a good link for a starting points is available
Android: PySide for Android
or if you like to use "webviews" instead of PySide: SL4A
Blackberry 10: BB-py
Meego: Python/Harmattan Project
SailFish OS: Harmattan apps (Meego) run without any problem
For your other questions I have a shorter answer.
The webkit component is intended as a content viewer component. Its not a component for building full HTML 5 apps.
The question which bindings for Qt are better is often asked. What you need to be aware of is that the old version of PyQt did almost the same as PySide. The difference was mainly in the license! However PyQt supports now Qt 5 while PySide doesn't, so make your own choice. I think you can make beautiful apps with both of them.