qt - 我可以在 Qt 中制作 Material 抽屉导航和 FAB 吗?

标签 qt qml qt5 qtquick2 qtquickcontrols2

我是 Qt 新手,我下载了带有 Quick Controls 2.0 的 v 5.7 主要用于 Android 开发,我想知道是否有可能使用一些 Material 控件,例如滑动抽屉导航和 float 操作按钮,因为它们现在无处不在(例如最近 Twitter 应用程序)。

谢谢。

最佳答案

使用 Qt Quick Controls 2.0 中的 Drawer。我还在寻找应用程序抽屉和 here it is

为了帮助你,我做了一个简单的例子。将其粘贴到您的 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
        }
    }
}

关于qt - 我可以在 Qt 中制作 Material 抽屉导航和 FAB 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37774936/

相关文章:

c++ - Qt5 : Strange compilation error while using QCommandLineParser class

c++ - 为什么 QLineEdit with QCompleter for auto completion 没有出现?

python - QtQuick GeometryChanged 方法仅适用于加载组件的一个方向

c++ - 销毁 qml 对象后的信号槽连接?

qt - 如何在 Qt TableView 中实现类似过滤的电子表格?

c++ - 在 Qt5 中实现基于单元格的小部件

Qt4 QSslSocket 触发 HTTP 406 响应

c++ - 替换 Qt 中的小部件

c++ - 在 QML 中调用 C++ 对象的不存在成员有效 "as expected"但为什么呢?

qt - Android 和 iOS 上的 QML App 全屏/沉浸式模式