Today I've updated to Qt 5.9, I'm trying of use ScrollView, but this require this library: import QtQuick.Controls 2.3
When I import the library, and run, i receive this error:
QtQuick.Controls 2.3 is not installed.
This is impossibile, because I've installed last release qt 5.9
I need to use import QtQuick.Controls 2.1 to scroll content on android and ios.
Any solutions?
The documentation you link, is from the dev-branch of Qt5.10 - this will probably come with QtQuick.Controls 2.3, so the import-statement there seems legit.
Your error-message is also correct, as Qt5.9 ships with QtQuick.Controls 2.2
The documentation link of yours however states, that ScrollView is available since Qt5.9 - which is also backed by the documentation of this version, that can be found here - however then it is necessary to import the installed version QtQuick.Controls 2.2
If that does not work, I don't really see the superiority of the ScrollView over the old-style attatching ScrollBars to Flickables.
Related
I have installed Qt 6.0.3 and 6.1.0.
And I want to create Qt 6 Quick project.
I start Qt Creator, click "New", "Qt Quick Application - Empty", "Choose...".
Then I type the name of my project and click "Next".
On the "Build System" step I select any build system(qmake, CMake or QBS, it does not affect the next step) and click "Next".
On the next step "Details" there is a drop-down with a list of available Qt versions. But it does not contain Qt 6!
How to create Qt 6 Qt Quick project?
Latest Qt Creator's (4.14.2 at the time of answering) new project assistant does not provide the option to require Qt 6 as a minimal version yet. There is an open bug about the missing feature in Qt Bug Tracker: New project assistant: no minimal Qt version >= 6.0
However, as #JarMan already commented you actually configure your project for specific kit and selecting e.g. Qt 6.0.3 kit means that you configure and build your application against that Qt version.
In fact, minimal Qt version selection in Qt Quick application wizard affects versions of the QML import statements used in generated QML files. E.g. selecting Qt 5.12 as minimal version means that you get import QtQuick 2.12 and import QtQuick.Window 2.12 written to your main.qml. And selecting Qt 5.15 as minimal version means getting import QtQuick 2.15 and import QtQuick.Window 2.15, and so on.
In Qt 6 version numbers may be omitted from imports in QML. If the version is omitted, the latest version will be used.
Most probably it means that when Qt Creator starts supporting Qt 6 as minimal version respective generated import statements will be import QtQuick and import QtQuick.Window.
You can actually edit your generated Qt Quick application so that you manually remove version numbers from import statements if you wish. It will turn your application to minimal Qt6 application because that application cannot be built with Qt5 kits anymore.
By qVersion() I will get the Qt version as 5.13.1
But in QML I use import QtQuick 2.12. How to get the QtQuick version C++/QML (2.12)?
I do not know of any way to "print the QtQuick version" (as per your comment on your question). However, reading the docs it seems that it is just a 1:1 mapping between the Qt version and the QtQuick version.
This Qt forum post appears to confirm that post:
Every new Qt release gets a new QtQuick version. It's a 1 to 1 mapping so far: Qt 5.x has QtQuick 2.x (so, Qt 5.4 has QtQuick 2.4). You can check that by opening the documentation for - for example - Rectangle or Item.
Here's the corresponding documentation that shows the mapping of the Qt version and the QtQuick(Controls) version: https://doc.qt.io/qt-5/qtquickcontrols-index.html
From that it would appear that you need to use/import QtQuick 2.13 when you're using Qt 5.13.
I know what version of Qt I'm shipping my app with. And I suppose a single version of Qt contains only a single version of each QML module. So if I were to write:
import QtQuick
(no version specified), that would be unambiguous. So why is it necessary to specify the module version?
It is, so everyone can see, which version is demanded.
It might be that you ship your code, using features of QtQuick 2.7, someone
tries to open it with an older version (say: QtQuick 2.5) and strangely - it's broken.
If you import a specific version, it is clear, that the error stems from an too old version.
I think it is the best to always try to use the least version. So unless you use features of QtQuick 2.7, declare the older ones, to maximize compatibility.
I'm trying to add a WebView to my GUI. First, the app crashed unexpectedly everytime. I figured I probably needed to import WebKit 3.0 along with WebView 1.1. After adding the required import statement, I try to run but it says that module "QtWebKit" is not installed. I checked the include folder and its indeed not there.
So my question is if QtWebKit is what I need, how do I install it?
Update:
When this code exists in my .qml file, the app crashes without starting:
WebEngineView{
anchors.fill: parent
url: "http://www.google.com"
}
This is the import statement I'm using on QT 5.6:
import QtWebEngine 1.1
This is the segmentation fault error generated because of the presence of the code mentioned above:
Full demo code:
import QtQuick 2.6
import QtQuick.Controls 1.5 as QC
import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
import QtQuick.Dialogs 1.2
import QtMultimedia 5.6
import Qt.labs.controls 1.0
import QtWebEngine 1.2
ApplicationWindow {
height: 640
width: 480
visible: true
Loader{
anchors.fill: parent
sourceComponent: webComponent
}
Component{
id: webComponent
WebEngineView{
anchors.fill: parent
id: web
profile: WebEngineProfile {
storageName: "Default"
}
}
}
}
Your debugger's stack trace shows that your crash is occurring in Qt's OpenGL functions. Remember to call QtWebEngine::initialize() before you start using Qt WebEngine.
Note also:
Qt WebView is a lightweight module for running your mobile OS's native web engine. Its main QML type is called WebView.
Qt WebKit is a heavyweight module for running a fully self-contained web engine. Its main QML type is also called WebView, but this is completely unrelated to the other WebView. This module is now deprecated.
Qt WebEngine is a heavyweight module for running a fully self-contained web engine. Its main QML type is called WebEngineView. This module is meant to replace Qt WebKit.
Qt WebKit is a deprecated module. Maybe you can install it from Qt sources, but since you want to use WebView 1.1 (and that you're on Qt5.6), I think you'd better use Qt WebEngine (using deprecated modules is not recommended).
You can already see it in your folder (modules QtWebEngine and QtWebView).
I want to learn qt by using the tutorial below
http://qt-project.org/doc/qt-5/gettingstartedqml.html
The tutorial are using QtQuick 2.3 which I dont have. I only have QtQuick 2.2(autogenerated when creating new project). Where do I find this QtQuick 2.3?
Im just starting Qt few days ago which I downloaded the latest version of Qt. I also try to update using MaintenanceTool.exe. I can confirm that i have the latest version.
Im using the free open source version of Qt.
Where do I find this QtQuick 2.3?