|
@@ -24,74 +24,89 @@
|
|
|
*/
|
|
|
|
|
|
import QtQuick 2.9
|
|
|
-import QtQuick.Controls.Material 2.9
|
|
|
import QtQuick.Layouts 1.1
|
|
|
import qtprotobuf.examples.addressbook 1.0
|
|
|
|
|
|
-ListView {
|
|
|
- id: contactList
|
|
|
+Item {
|
|
|
+ id: root
|
|
|
anchors.fill: parent
|
|
|
- delegate: Rectangle {
|
|
|
- id: contactDelegate
|
|
|
- property Contact contact: model.modelData
|
|
|
- color: "#81D4FA"
|
|
|
- width: contactList.width
|
|
|
- height: 80
|
|
|
- ColumnLayout {
|
|
|
- anchors.fill: parent
|
|
|
- anchors.margins: 10
|
|
|
- Row {
|
|
|
- Layout.alignment: Qt.AlignVCenter
|
|
|
- Text {
|
|
|
- id: firstName
|
|
|
- color: "#FFFFFF"
|
|
|
- text: contactDelegate.contact.firstName
|
|
|
- font.pointSize: 12
|
|
|
+ property alias model: contactList.model
|
|
|
+ signal requestAddContact()
|
|
|
+ ListView {
|
|
|
+ id: contactList
|
|
|
+ anchors.fill: parent
|
|
|
+ delegate: Item {
|
|
|
+ id: contactDelegate
|
|
|
+ property Contact contact: model.modelData
|
|
|
+ width: contactList.width
|
|
|
+ height: 80
|
|
|
+ ColumnLayout {
|
|
|
+ anchors.fill: parent
|
|
|
+ anchors.margins: 10
|
|
|
+ Row {
|
|
|
+ Layout.alignment: Qt.AlignVCenter
|
|
|
+ spacing: 5
|
|
|
+ Text {
|
|
|
+ id: firstName
|
|
|
+ color: "#FFFFFF"
|
|
|
+ text: contactDelegate.contact.firstName
|
|
|
+ font.pointSize: 12
|
|
|
+ font.weight: Font.Bold
|
|
|
+ }
|
|
|
+ Text {
|
|
|
+ id: middleName
|
|
|
+ anchors.verticalCenter: parent.verticalCenter
|
|
|
+ color: "#FFFFFF"
|
|
|
+ text: contactDelegate.contact.middleName
|
|
|
+ font.pointSize: 12
|
|
|
+ font.weight: Font.Bold
|
|
|
+ }
|
|
|
+ Text {
|
|
|
+ id: lastName
|
|
|
+ anchors.verticalCenter: parent.verticalCenter
|
|
|
+ color: "#FFFFFF"
|
|
|
+ text: contactDelegate.contact.lastName
|
|
|
+ font.pointSize: 12
|
|
|
+ font.weight: Font.Bold
|
|
|
+ }
|
|
|
}
|
|
|
- Text {
|
|
|
- id: middleName
|
|
|
- anchors.verticalCenter: parent.verticalCenter
|
|
|
- color: "#FFFFFF"
|
|
|
- text: contactDelegate.contact.middleName
|
|
|
- font.pointSize: 12
|
|
|
- }
|
|
|
- Text {
|
|
|
- id: lastName
|
|
|
- anchors.verticalCenter: parent.verticalCenter
|
|
|
- color: "#FFFFFF"
|
|
|
- text: contactDelegate.contact.lastName
|
|
|
- font.pointSize: 12
|
|
|
+ Row {
|
|
|
+ Layout.alignment: Qt.AlignVCenter
|
|
|
+ Text {
|
|
|
+ id: defaultPhoneNumberText
|
|
|
+ property PhoneNumber defaultPhoneNumber: contactDelegate.contact.phonesData.length > 0 ?
|
|
|
+ contactDelegate.contact.phonesData[0] : null
|
|
|
+ visible: defaultPhoneNumber != null
|
|
|
+ color: "#EEEEEE"
|
|
|
+ text: defaultPhoneNumber ?
|
|
|
+ "+" + defaultPhoneNumber.countryCode + " " + defaultPhoneNumber.number : ""
|
|
|
+ font.pointSize: 12
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- Row {
|
|
|
- Layout.alignment: Qt.AlignVCenter
|
|
|
- Text {
|
|
|
- id: defaultPhoneNumberText
|
|
|
- property PhoneNumber defaultPhoneNumber: contactDelegate.contact.phonesData.length > 0 ?
|
|
|
- contactDelegate.contact.phonesData[0] : null
|
|
|
- visible: defaultPhoneNumber != null
|
|
|
- color: "#EEEEEE"
|
|
|
- text: defaultPhoneNumber ?
|
|
|
- "+" + defaultPhoneNumber.countryCode + " " + defaultPhoneNumber.number : ""
|
|
|
- font.pointSize: 12
|
|
|
- }
|
|
|
+ Rectangle {
|
|
|
+ color:"#EEEEEE"
|
|
|
+ anchors.left: parent.left
|
|
|
+ anchors.right: parent.right
|
|
|
+ height: 2
|
|
|
}
|
|
|
- }
|
|
|
- Rectangle {
|
|
|
- color:"#EEEEEE"
|
|
|
- anchors.left: parent.left
|
|
|
- anchors.right: parent.right
|
|
|
- height: 2
|
|
|
- }
|
|
|
|
|
|
- Rectangle {
|
|
|
- color:"#EEEEEE"
|
|
|
- anchors.left: parent.left
|
|
|
- anchors.right: parent.right
|
|
|
- anchors.top: parent.bottom
|
|
|
- height: 2
|
|
|
- visible: (contactList.count - 1) === model.index
|
|
|
+ Rectangle {
|
|
|
+ color:"#EEEEEE"
|
|
|
+ anchors.left: parent.left
|
|
|
+ anchors.right: parent.right
|
|
|
+ anchors.top: parent.bottom
|
|
|
+ height: 2
|
|
|
+ visible: (contactList.count - 1) === model.index
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
|
|
|
+ FloatingRoundButton {
|
|
|
+ anchors.bottom: parent.bottom
|
|
|
+ anchors.right: parent.right
|
|
|
+ anchors.margins: 10
|
|
|
+ icon: "qrc:/images/plus.png"
|
|
|
+ onClicked: root.requestAddContact()
|
|
|
+ }
|
|
|
+}
|