Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.12
- import QtQuick.Window 2.12
- import QtQuick.Controls 2.12
- ApplicationWindow {
- visible: true
- width: 640
- height: 480
- title: qsTr("Hello World")
- header: ToolBar {
- ToolButton{
- text: qsTr("Menu")
- onClicked: drawer.open()
- }
- }
- Drawer {
- id: drawer
- width: 200
- height: parent.height
- Page {
- anchors.fill: parent
- ListModel {
- id: myModel
- }
- Component {
- id: addFormComponent
- Popup {
- id: popupItem
- anchors.centerIn: parent
- parent: Overlay.overlay
- Column {
- TextField {
- id: nameField
- }
- Button {
- text: qsTr("Add")
- onClicked: {
- myModel.append({"name": nameField.text})
- popupItem.close()
- popupItem.destroy()
- }
- }
- }
- }
- }
- header: ToolBar {
- Row {
- ToolButton {
- text: qsTr("Add")
- onClicked: {
- var popup = addFormComponent.createObject(this)
- popup.open()
- }
- }
- }
- }
- ListView {
- anchors.fill: parent
- delegate: ItemDelegate {
- width: parent.width
- text: name
- }
- model: myModel
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement