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. qml listview resize leads to content change in large screen
Forum Updated to NodeBB v4.3 + New Features

qml listview resize leads to content change in large screen

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 624 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.
  • Y Offline
    Y Offline
    yupengfei
    wrote on last edited by
    #1

    My qml

    import QtQuick 2.8
    import QtQuick.Window 2.2
    
    Window {
        visible: true
        width: 640
        height: 480
        MouseArea {
            anchors.fill: parent
            onClicked: {
                mainAreaView.currentIndex = 2
            }
        }
    
        Rectangle {
            width: 200
            height: parent.height
            anchors.left: parent.left
            ListView {
                id: mainAreaView
                width: parent.width
                height: parent.height
                interactive:false
                model:mainItemModel
                currentIndex: 0
                clip: true
                snapMode: ListView.SnapToItem
                orientation: ListView.Vertical
                highlightMoveDuration: 10
                onCurrentItemChanged: {
                    console.log("mainAreaView current item changed to ", currentIndex)
                }
                onCurrentIndexChanged: {
                    console.log("mainAreaView current index changed to ", currentIndex)
                }
            }
            VisualItemModel {
                id: mainItemModel
                Rectangle {
                    width: mainAreaView.width
                    height: mainAreaView.height
                    color: "blue"
                }
    
                Rectangle {
                    width: mainAreaView.width
                    height: mainAreaView.height
                    color: "red"
                }
    
                Rectangle {
                    width: mainAreaView.width
                    height: mainAreaView.height
                    color: "green"
                }
    
                Rectangle {
                    width: mainAreaView.width
                    height: mainAreaView.height
                    color: "black"
                }
            }
        }
    }
    

    After startup, click the mouse leads the Rectangle to green
    0_1508407439316_1.png

    After click the maximize button,the Rectangle turned red on large screen with Resolution 2560*1440。
    0_1508407594036_3.png

    But at Resolution 1024*600, everything work fine.

    Does anyone have an idea?

    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