Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Use ScrollBar when "import QtQuick.Controls 2.0 as 'SomeTag'"
Forum Update on Monday, May 27th 2025

Use ScrollBar when "import QtQuick.Controls 2.0 as 'SomeTag'"

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 275 Views
  • 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.
  • carles.sole.grauC Offline
    carles.sole.grauC Offline
    carles.sole.grau
    wrote on last edited by carles.sole.grau
    #1

    Hi everybody,
    I have a problem when I'm trying to add a ScrollBar in a Flickable.
    My problem is that I import QtQuick.Controls 2.0 as => "import QtQuick.Controls 2.0 as 'SomeTag'" because I want to differentiate between QtQuick.Controls 1.4.

    The example in the doc is like this:

    Flickable {
        // ...
        ScrollBar.vertical: ScrollBar { }
    }
    

    But to fit in my Code I have to use:

    import QtQuick 2.7
    import QtQuick.Controls 2.0 as Phone
    import QtQuick.Controls 1.4 as Desktop
    
    Phone.Page{
        title: "MyPage"    
        Flickable {
            id: flickable       
            anchors.fill: parent
            contentHeight: flickableChildItem.height
            boundsBehavior: Flickable.StopAtBounds
            Phone.ScrollBar.vertical: Phone.ScrollBar{}
        }//Flickable
    }//Page
    

    When I try to run my code, this problem appears:

       qrc:/QML/MyPage.qml:7:5: Cannot assign object to read only list
    

    I would like to keep this:

    import QtQuick 2.7
    import QtQuick.Controls 2.0 as Phone
    import QtQuick.Controls 1.4 as Desktop
    

    Because sometimes I like to use some QtQuick.Controls 1.4 Item.

    Thank you very much

    1 Reply Last reply
    0

    • Login

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