[Interest] [Quick] GridView inside the Layout

Sina Dogru sinadooru at gmail.com
Thu Mar 24 08:39:26 CET 2016


I guess my assumption about qt-quick Layouts might not be right. Consider a
window where there are some properties, but they all inside a
`ColumnLayout` so that `ScrollView` would be able to use on it. Also there
is some QtQuick.Controls inside them. I guess code would be more expository.

import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1

Window {
    visible: true
    height: 500
    width: 500

    ColumnLayout {
        anchors.fill: parent

        GroupBox {
            Layout.fillWidth: true
            ColumnLayout {
                anchors.fill: parent
                GridView {
                    cellWidth: 100
                    cellHeight: 20
                    Layout.fillWidth: true

                    model: [ "1", "2", "3", "4", "5", "6", "7" ]

                    delegate: Rectangle {
                        width: GridView.view.cellWidth
                        height: GridView.view.cellHeight
                        color: "red"
                        Text {
                            anchors.fill: parent
                            verticalAlignment: Text.AlignVCenter
                            horizontalAlignment: Text.AlignHCenter
                            text: modelData
                        }
                    }
                }
            }
        }
    }
}

When I run this code, qmlengine gives an error about the implicitWidth and
implicitHeight,

qrc:/main.qml:14:9: QML GroupBox: Binding loop detected for property
"implicitWidth"

qrc:/main.qml:14:9: QML GroupBox: Binding loop detected for property
"implicitWidth"

qrc:/main.qml:14:9: QML GroupBox: Binding loop detected for property
"implicitHeight"

qrc:/main.qml:14:9: QML GroupBox: Binding loop detected for property
"implicitHeight"


I assume using `GridView` inside `ColumnLayout` causes that. Because when
use a `Rectangle` instead of a `GridView` engine does not give any errors.

So can someone please point where am I doing wrong?

Thank you,
Sina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160324/c19e0dde/attachment.html>


More information about the Interest mailing list