[Interest] [Quick] GridView inside the Layout

Curtis Mitch mitch.curtis at theqtcompany.com
Thu Mar 24 11:02:28 CET 2016


"The implicit size of the GroupBox<http://doc.qt.io/qt-5/qml-qtquick-controls-groupbox.html> is calculated based on the size of its content. If you want to anchor items inside the group box, you must specify an explicit width and height on the GroupBox<http://doc.qt.io/qt-5/qml-qtquick-controls-groupbox.html> itself."

[1] http://doc.qt.io/qt-5/qml-qtquick-controls-groupbox.html#details

________________________________
From: Interest <interest-bounces+mitch.curtis=theqtcompany.com at qt-project.org> on behalf of Sina Dogru <sinadooru at gmail.com>
Sent: Thursday, 24 March 2016 08:39
To: interest at qt-project.org
Subject: [Interest] [Quick] GridView inside the Layout

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/29ff47b8/attachment.html>


More information about the Interest mailing list