Qt QML布局的高度不正确

Qt QML布局的高度不正确,qt,qml,Qt,Qml,我有一个qml布局,应用程序窗口没有伸展到正确的高度,无法滚动工作 这是我的密码: import QtQuick 2.4 import QtQuick.Controls 1.3 import QtQuick.LocalStorage 2.0 import QtQuick.Window 2.0 import "db.js" as DB ApplicationWindow { id: root visible: true width: Screen.width ti

我有一个qml布局,应用程序窗口没有伸展到正确的高度,无法滚动工作

这是我的密码:

import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.LocalStorage 2.0
import QtQuick.Window 2.0
import "db.js" as DB

ApplicationWindow {
    id: root
    visible: true
    width: Screen.width
    title: "Nákupy"

    menuBar: MenuBar {

        Menu {
            title: "Smazat"
            MenuItem {
                text: "&Smazat seznam"
                onTriggered: {
                    console.log("Open action triggered");
                }
            }
        }
    }

    Flickable {
        id: flickable
        anchors.fill: parent
        contentHeight: column.height
        contentWidth: root.width

        Column {
            anchors.fill: parent
            id: column

            Label {
                id: welcometext
                text: "Test"
                horizontalAlignment: Text.AlignHCenter
                y: 10
                anchors.margins: 10
                width: root.width
            }

            Repeater {
                y: welcometext.top + welcometext.height + 10
                id: repeater
                model: lmodel
                Button {
                    id: b
                    text: m_text
                    x: 20
                    width: root.width - 40
                    height: 70
                    onClicked: {
                        visible = false;
                    }
                }
            }

            Button {
                y: repeater.top + repeater.height + 30
                width: root.width
                text: "Přidat položku"
                onClicked: {
                    console.log("clicked")
                }
            }

        }
    }

    ListModel {
        id: lmodel
    }

    Component.onCompleted: {
        DB.open().transaction(function(tx){
            tx.executeSql("CREATE TABLE IF NOT EXISTS products (id INTEGER PRIMARY KEY, name TEXT, done INTEGER)");
        });
        console.log(column.height);
        for(var i = 0; i < 10; i++) {
            lmodel.append({m_text: "Test "+i});
        }
        console.log(column.height);
        console.log(welcometext.height);
    }

}
导入QtQuick 2.4
导入QtQuick.Controls 1.3
导入QtQuick.LocalStorage 2.0
导入QtQuick.Window 2.0
将“db.js”作为数据库导入
应用程序窗口{
id:根
可见:正确
宽度:Screen.width
标题:“纳库比”
菜单栏:菜单栏{
菜单{
标题:“Smazat”
梅努伊特姆{
文本:“&Smazat seznam”
反对:{
控制台日志(“已触发的打开操作”);
}
}
}
}
轻快的{
id:flickable
锚定。填充:父级
contentHeight:column.height
contentWidth:root.width
纵队{
锚定。填充:父级
id:列
标签{
id:welcometext
文本:“测试”
水平对齐:Text.AlignHCenter
y:10
2.5.2.利润率:10
宽度:root.width
}
中继器{
y:welcometext.top+welcometext.height+10
id:中继器
型号:L型号
钮扣{
身份证号码:b
文本:m_text
x:20
宽度:root.width-40
身高:70
再次点击:{
可见=假;
}
}
}
钮扣{
y:中继器。顶部+中继器。高度+30
宽度:root.width
正文:“Přidat položku”
再次点击:{
console.log(“单击”)
}
}
}
}
列表模型{
id:L模型
}
Component.onCompleted:{
DB.open()事务(函数(tx){
tx.executeSql(“创建表,如果不存在产品(id整数主键、名称文本、完成整数)”);
});
控制台.日志(列.高度);
对于(变量i=0;i<10;i++){
追加({m_text:“Test”+i});
}
控制台.日志(列.高度);
console.log(welcometext.height);
}
}
列报告高度0。

尝试使用:

如果未指定宽度或高度,则定义项目的自然宽度或高度

大多数项目的默认隐式大小为0x0,但某些项目具有无法覆盖的固有隐式大小[…]

设置隐式大小对于定义基于内容具有首选大小的组件非常有用[…]

尝试使用:

如果未指定宽度或高度,则定义项目的自然宽度或高度

大多数项目的默认隐式大小为0x0,但某些项目具有无法覆盖的固有隐式大小[…]

设置隐式大小对于定义基于内容具有首选大小的组件非常有用[…]