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. Setting contentX on Flickable is ignored.
Qt 6.11 is out! See what's new in the release blog

Setting contentX on Flickable is ignored.

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.3k Views 1 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.
  • K Offline
    K Offline
    Kysymys
    wrote on last edited by
    #1

    Hi there,

    In the following source, setting the contentX property is ignored.
    Can anyone tell me why?

    @
    import QtQuick 2.0

    Rectangle {
    width: 360
    height: 360

    Text {
        anchors.fill: parent
        text: "Info:"
              + "\n contentX:" + flickable.contentX
              + "\n contentWidth:" + flickable.contentWidth
              + "\n width:" + flickable.width
    }
    
    Rectangle {
        id: container
    
        anchors.top: parent.top
        anchors.right: parent.right
        anchors.margins: 10
        width: 200; height: 100;
        color: "lightsteelblue"
    
        Rectangle {
            id: touchArea
            
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.bottom: parent.bottom
            width: 50
            color: "cornsilk"
        }
        Flickable {
            id: flickable
    
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.bottom: parent.bottom
            width: 50
    
            contentWidth: draggable.width
            contentHeight: draggable.height
            
            // This seems to have no effect at all
            contentX: 100
    
            Rectangle {
                id: draggable
                width: 150;
                height: flickable.height;
                color: "#30ff0000"
            }
        }
    }
    

    }
    @

    To add to the confusion:
    if you move the Flickable into the Rectangle (touchArea) and use the fill anchor, everything works as expected.

    @
    import QtQuick 2.0

    Rectangle {
    width: 360
    height: 360

    Text {
        anchors.fill: parent
        text: "Info:"
              + "\n contentX:" + flickable.contentX
              + "\n contentWidth:" + flickable.contentWidth
              + "\n width:" + flickable.width
    }
    
    Rectangle {
        id: container
    
        anchors.top: parent.top
        anchors.right: parent.right
        anchors.margins: 10
        width: 200; height: 100;
        color: "lightsteelblue"
    
        Rectangle {
            id: touchArea
            
            anchors.top: parent.top
            anchors.left: parent.left
            anchors.bottom: parent.bottom
            width: 50
            color: "cornsilk"
    
            Flickable {
                id: flickable
    
                anchors.fill: parent
    

    // anchors.top: parent.top
    // anchors.left: parent.left
    // anchors.bottom: parent.bottom
    // width: 50

                contentWidth: draggable.width
                contentHeight: draggable.height
    
                // This is set just fine
                contentX: 100
    
                Rectangle {
                    id: draggable
                    width: 150;
                    height: flickable.height;
                    color: "#30ff0000"
                }
            }
        }
    }
    

    }
    @

    \o/ \o/ Kudos ...

    Paholaisen Kysymys

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kysymys
      wrote on last edited by
      #2

      Since I've not become any smarter and the community doesn't seem to have an answer too, I've issued this as a bug.
      https://bugreports.qt-project.org/browse/QTBUG-30837

      \o/ \o/ Kudos ...

      Paholaisen Kysymys

      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