blob: 8a0872e09dd7d6bb2e2a57e92d47dacb1168d869 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.12
import "QuickAddressBookTypes"
Window {
id: mainWindow
visible: true
width: 480
height: 640
color: "darkgray"
title: qsTr("Address Book")
ListModel {
id: addressList
}
NewAddressPopup {
id: newAddressPopup
onAddressAdded: addressList.append({name: newName, addr: newAddr})
}
ColumnLayout {
id: mainWindowLayout
anchors.left: parent.left; anchors.right: parent.right
spacing: 0
Button {
id: addButton
anchors.left: parent.left
anchors.right: parent.right
text: "Add..."
font.pointSize: 24
onClicked: newAddressPopup.open()
}
Repeater {
id: addressListViewer
model: addressList
anchors.left: parent.left
anchors.right: parent.right
AddressBookItem {
id: addressBookItem
onRemoved: addressList.remove(index)
}
}
}
}
|