我可以在 Qt 中制作 Material 导航抽屉和 FAB 吗?
Can I make a Material Navigation Drawer and FAB in Qt?
我是 Qt 的新手,我下载了带有 Quick Controls 2.0 的 v 5.7 主要用于 Android 开发,我想知道是否有可能使用一些 material 控件,如滑动导航抽屉和浮动操作按钮,因为它们现在无处不在(例如最近的 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 5.8 发布以来,Qt Quick Controls 2.1 有一个名为 RoundButton
, which has an elevation effect in the Material style. It is demonstrated as a Floating Action Button in the Text Editor Example:
的 QML 类型
我是 Qt 的新手,我下载了带有 Quick Controls 2.0 的 v 5.7 主要用于 Android 开发,我想知道是否有可能使用一些 material 控件,如滑动导航抽屉和浮动操作按钮,因为它们现在无处不在(例如最近的 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 5.8 发布以来,Qt Quick Controls 2.1 有一个名为 RoundButton
, which has an elevation effect in the Material style. It is demonstrated as a Floating Action Button in the Text Editor Example: