Qt5.8 QML控件2。如何在父项目中制作自上而下的“抽屉”?

时间:2017-02-26 21:46:13

标签: qt qml qtquick2 qtquickcontrols2 qt5.8

我尝试使用Controls2 Drawer在父项目中制作自上而下的抽屉。如果我设置edge.QtTopEdge,程序会挂起。但它适用于QtLeftEdge

我做错了什么。

这是代码,

import QtQuick 2.7
import QtQuick.Controls 2.1

ApplicationWindow
{
    visible: true
    width: 800
    height: 1024

    Item
    {
        id: area
        anchors.fill: parent
        Column
        {
            width: parent.width
            Rectangle
            {
                width: parent.width
                height: 100
                color: "blue"
            }

            Rectangle
            {
                id: yellowbit
                width: parent.width
                height: area.height - 100
                color: "yellow"
            }
        }
    }

   Drawer 
    {
        // i want to put the drawer within the "yellowbit"
        id: drawer
        width: yellowbit.width
        height: yellowbit.height
        parent: yellowbit

        // comment this out and it works as a left drawer
        // but as a top drawer, it hangs up
        edge: Qt.TopEdge

        Rectangle
        {
            anchors.fill: parent
            color: "red"
        }
    }
}

感谢您的帮助

0 个答案:

没有答案