怎么用QML做个简单的折叠菜单啊,分全捐

ibigdatas 2013-04-24 10:46:38
我是菜鸟,刚学qt,现在想用qml做个菜单
实现功能一::
点击主菜单,展开,显示子菜单
再次点击主菜单,闭合,隐藏子菜单。
主菜单可以上下拖动。
实现功能二:
当点击子菜单的时候,把子菜单的文本输出到整个窗口的hello world那里。
就实现这两个功能,界面我设计好了。你只要写下折叠效果的代码和输出文本的功能就行。
如果能帮我实现功能,分数全给,并且酌情给予适当话费奖励,请留下你的QQ号方便我联系你,我QQ457667976,验证:csdn

import QtQuick 2.0

Rectangle {
width: 360
height:600
//顶部显示模块
Rectangle{
id:texttop
width: 250
height:40
border.width: 1
x:60
y:30
color: "#ccc1c1"
radius: 10

Text {
id:title
text:"Hello World !"
font.pointSize: 13
anchors.centerIn: parent
}
}
//中间大矩形区域
Rectangle{
id:center
width: 260
height: 450
color: "#ccc1c1"
x:55
y:100
radius: 10
//测试模块A
Rectangle{
id:a
width: 200
height: 40
color: "green"
x:20
y:20
radius: 10
Text {
id:testA
text:"测试模块A"
style: Text.Raised
font.pointSize: 16
anchors.centerIn: parent
}

}

//测试模块B
Rectangle{
id:b
width: 200
height: 40
color: "blue"
x:20
y:80
radius: 10
Text {
id:testB
text:"测试模块B"
style: Text.Raised
font.pointSize: 16
anchors.centerIn: parent
}
}

//测试模块C
Rectangle{
id:c
width: 200
height: 40
color: "#f748f2"
x:20
y:140
radius: 10
Text {
id:testC
text:"测试模块C"
style: Text.Raised
font.pointSize: 16
anchors.centerIn: parent
}
}



//测试模块D
Rectangle{
id:d
width: 200
height: 40
color: "#f748f2"
x:20
y:200
radius: 10
Text {
id:testD
text:"测试模块D"
style: Text.Raised
font.pointSize: 16
anchors.centerIn: parent
}
}
}

}
...全文
394 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

16,212

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧