Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Problem with Qt Quick imports
Forum Updated to NodeBB v4.3 + New Features

Problem with Qt Quick imports

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 781 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MrBoltonM Offline
    MrBoltonM Offline
    MrBolton
    wrote on last edited by
    #1

    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 to import QtQuick.Controls 1.4. The docs for the SwipeView tell me to import 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!

    1 Reply Last reply
    0
    • Julien BJ Offline
      Julien BJ Offline
      Julien B
      wrote on last edited by
      #2

      Hello @MrBolton,

      Is it possible for you to use à Flickable (or ListView/GridView) instead of a ScrollView?

      1 Reply Last reply
      0
      • jpnurmiJ Offline
        jpnurmiJ Offline
        jpnurmi
        wrote on last edited by
        #3

        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...

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved