1、设置应用图标
1、需要图为.ico 格式 ;2、RC_ICONS = image/logo.ico (相对路径 )若在qrc/ 下 则RC_ICONS = logo.ico ;3、重新make

2、应用程序(ApplicationWindow)隐藏标题栏、最小化、拖拽
隐藏标题栏: flags:Qt.FramelessWindowHint|Qt.Window //去掉标题栏(标题栏提供了最大化,最小化、拖拽)
最小化:mainWindow.visibility=Window.Minimized(ApplicationWindow的id是mainWindow)
ApplicationWindow进行随意拖拽:
MouseArea{
anchors.fill: parent
acceptedButtons: Qt.LeftButton
property point cliCkPos: "0,0"
onPressed: {
cliCkPos=Qt.point(mouse.x,mouse.y) //得到鼠标的位置
}
onPositionChanged: {//鼠标按下后位置改变
var delta=Qt.point(mouse.x-cliCkPos.x,mouse.y-cliCkPos.y)
mainWindow.x=(mainWindow.x+delta.x) //
mainWindow.y=(mainWindow.y+delta.y)
}
} //MouseArea end
3、常用控件的封装(下拉框、checkbox、对话框)以后可以直接在基础上扩展
效果图:




网友评论