创建简单的入门菜单QTQICK/QML
我想用简单的动画创建qml中的按钮菜单 “ nofollow noreferrer”> simple qml
菜单
编辑:我也添加了此代码,但是每当我单击任何按钮时,菜单都会消失
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.15
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
Menu {
id: menu
visible: true
MenuItem {
Button{
text:"Play"
}
}
MenuItem {
Button{
text:"Play"
}
}
MenuItem {
Button{
text:"Sett"
}
}
}
}
I want to create menu of buttons in QML with simple animation
Simple QML Menu
When I add a button after another I only get the last one
Edit: I added this code also but everytime I click any button the menu disappears
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.15
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
Menu {
id: menu
visible: true
MenuItem {
Button{
text:"Play"
}
}
MenuItem {
Button{
text:"Play"
}
}
MenuItem {
Button{
text:"Sett"
}
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
a menuitem 指的是添加一个按钮小时候的按钮。
文档显示了许多简单的示例,例如:
A MenuItem already derives from AbstractButton, so there's no point in adding a Button as a child of the MenuItem.
The docs show many simple examples, like this: