赞
踩
- import QtQuick 2.14
- import QtQuick.Window 2.14
- import QtQuick.Controls 2.5
- import QtQuick.Layouts 1.15
- import "./common.js" as FunJs
-
- Window
- {
- id: window
- width: 600
- height: 480
- visible: true
- title: "QML Demo"
-
- Item
- {
- id: rootItem
- anchors.fill: parent
- property var colorBuilder: FunJs.getColorBudider(Qt.rgba)
-
- Row
- {
- id: header
- Component
- {
- id: menuButton
- Button
- {
- required property string menuText
- required property var layout
- required property int index
-
- text: menuText
- onClicked:
- {
- layout.currentIndex = index
- }
-
- }
- }
-
-
- Component.onCompleted:
- {
- let munu = ["Home", "Help"]
- munu.forEach(function(item, index)
- {
- menuButton.createObject(header, {layout:stacklayout, menuText:item, index: index})
- }
- )
- }
- }
-
- StackLayout {
- id: stacklayout
- anchors.top: header.bottom
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- anchors.right: parent.right
-
- Component
- {
- id: pageComponent
- Rectangle{}
- }
-
- Component.onCompleted:
- {
- for(let i = 0; i < 2; ++i)
- {
- pageComponent.createObject(stacklayout, {color: rootItem.colorBuilder()})
- }
- }
- }
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。