Unsolved Problem with Qt Quick imports
-
Hi,
I've got another question, this time regarding QML imports. I want to use a ScrollView and a SwipeView in the same QML file.
I'm using Qt 5.7 and reading the docs for the ScrollView it says toimport QtQuick.Controls 1.4
. The docs for the SwipeView tell me toimport QtQuick.Controls 2.0
.In my naivety I used the last import, thinking it would give access to both components. However ScrollView is not available with QtQuick Control 2.0 and I can't import both versions either. Can I get this to work without splitting the code into separate QML files?
Thanks in advance!
-
-
You can use qualified (namespace) module imports.
import QtQuick.Controls 1.4 as QQC1 import QtQuick.Controls 2.0 as QQC2 QQC2.ApplicationWindow { QQC1.ScrollView { // ... } }
Alternatively, you could use a Flickable with ScrollIndicator or ScrollBar from Qt Quick Controls 2...