erinn
/
ui
forked from cwtch.im/ui
1
0
Fork 0
ui/qml/widgets/ContactList.qml

73 lines
1.5 KiB
QML
Raw Normal View History

2018-10-23 18:52:13 +00:00
import QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
ColumnLayout {
id: root
2018-11-22 00:01:17 +00:00
MyProfile{ // CURRENT PROFILE INFO AND CONTROL BAR
2018-10-23 18:52:13 +00:00
id: myprof
}
2018-11-22 00:01:17 +00:00
Flickable { // THE ACTUAL CONTACT LIST
2018-10-23 18:52:13 +00:00
id: sv
//Layout.alignment: Qt.AlignLeft | Qt.AlignTop
clip: true
Layout.minimumHeight: 100
//Layout.maximumHeight: parent.height - 30
Layout.fillHeight: true
Layout.minimumWidth: parent.width
Layout.maximumWidth: parent.width
contentWidth: colContacts.width
contentHeight: colContacts.height
boundsBehavior: Flickable.StopAtBounds
2018-10-28 02:49:14 +00:00
maximumFlickVelocity: 400
2018-10-23 18:52:13 +00:00
2018-10-28 02:49:14 +00:00
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AlwaysOn
}
ColumnLayout {
2018-10-23 18:52:13 +00:00
id: colContacts
width: root.width
spacing: 0
Connections { // ADD/REMOVE CONTACT ENTRIES
target: gcd
2018-11-22 00:01:17 +00:00
onAddContact: function(handle, displayName, image, server, badge, status, trusted) {
2018-10-23 18:52:13 +00:00
contactsModel.append({
2018-11-22 00:01:17 +00:00
"_handle": handle,
"_displayName": displayName,
"_image": image,
"_server": server,
"_badge": badge,
"_status": status,
"_trusted": trusted,
2018-10-23 18:52:13 +00:00
})
}
}
ListModel { // CONTACT OBJECTS ARE STORED HERE ...
id: contactsModel
}
Repeater {
model: contactsModel // ... AND DISPLAYED HERE
2018-11-22 00:01:17 +00:00
delegate: ContactRow {
handle: _handle
displayName: _displayName
image: _image
server: _server
badge: _badge
status: _status
trusted: _trusted
2018-10-23 18:52:13 +00:00
}
}
}
}
}