4

I'm new to Qt, I downloaded v 5.7 with Quick Controls 2.0 mainly for Android development and I was wondering if there is a possibility to use some material controls like sliding navigation drawer and floating action button given their ubiquitousness now (e.g. twitter app lately).

Thanks.

4

2 回答 2

3

Drawer从 Qt 快速控件 2.0 开始使用。我也在寻找一个应用程序抽屉,在这里

为了帮助你,我做了一个简单的例子。将其粘贴到您的main.qml并运行它。

import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick 2.7

ApplicationWindow {
    id: window
    width: 480
    height: 640
    visible: true

    Drawer {
        id: drawer
        width: window.width/2
        height: window.height
        Rectangle{
            Column{
                spacing: 5
                Label{
                    text:"Awesome"
                }
                Label{
                    text:"Awesome"
                }
                Label{
                    text:"Awesome"
                }
                Label{
                    text:"Awesome"
                }
            }
        }
    }

    Rectangle {
        id: rectangle1
        color: "#ffffff"
        anchors.fill: parent
        anchors.centerIn: parent
        Label{
            id:label
            text:"Yeah Label is awesome"
        }
        Rectangle{
            id: rectangle
            anchors.centerIn: parent
            color:"Red"
            height: parent.height/2
            width: parent.width/2
        }
    }
}
于 2016-09-16T08:07:29.373 回答
3

Qt Quick Controls 2.1,自 Qt 5.8 发布以来,有一个名为 的 QML 类型RoundButton,它在 Material 样式中具有高程效果。它在文本编辑器示例中显示为浮动操作按钮

Qt Quick Controls 2 - 文本编辑器示例

于 2016-11-20T23:18:38.300 回答