Spectral/qml/form/ListForm.qml

148 lines
4.7 KiB
QML
Raw Normal View History

2018-02-23 14:39:14 +00:00
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Material 2.3
import "qrc:/qml/component"
Item {
2018-02-28 13:11:42 +00:00
property var listModel
2018-03-05 11:11:55 +00:00
property alias currentIndex: listView.currentIndex
2018-02-23 14:39:14 +00:00
ColumnLayout {
anchors.fill: parent
spacing: 0
Pane {
z: 10
Layout.fillWidth: true
Layout.preferredHeight: 80
background: Rectangle {
color: Qt.tint(Material.accent, "#20FFFFFF")
}
TextField {
id: serverField
width: parent.width
height: 36
leftPadding: 16
topPadding: 0
bottomPadding: 0
anchors.verticalCenter: parent.verticalCenter
background: Item {
Row {
anchors.fill: parent
Text {
width: parent.height
height: parent.height
text: "\ue8b6"
font.pointSize: 16
font.family: materialFont.name
color: "white"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
Text {
height: parent.height
text: "Search"
color: "white"
font.pointSize: 12
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
Rectangle {
width: serverField.activeFocus || serverField.text != "" ? parent.width : 0
height: parent.height
color: "white"
Behavior on width {
PropertyAnimation { easing.type: Easing.InOutQuad; duration: 200 }
}
}
}
}
}
Pane {
Layout.fillWidth: true
Layout.fillHeight: true
padding: 0
2018-03-01 11:56:02 +00:00
background: Item {
anchors.fill: parent
Rectangle {
anchors.fill: parent
color: "#eaeaea"
}
Text {
z: 10
text: "Here? No, not here."
2018-03-02 08:56:36 +00:00
color: "#424242"
2018-03-01 11:56:02 +00:00
anchors.centerIn: parent
visible: listView.count === 0
}
2018-02-23 14:39:14 +00:00
}
ListView {
id: listView
width: parent.width
height: parent.height
model: listModel
highlight: Rectangle {
color: Material.accent
opacity: 0.2
}
ScrollBar.vertical: ScrollBar { id: scrollBar }
delegate: ItemDelegate {
width: parent.width
height: 80
onClicked: listView.currentIndex = index
2018-02-28 13:11:42 +00:00
contentItem: Row {
width: parent.width - 32
height: parent.height - 32
spacing: 16
2018-02-23 14:39:14 +00:00
2018-02-28 13:11:42 +00:00
ImageStatus {
width: parent.height
height: parent.height
2018-03-14 09:11:45 +00:00
source: avatar == "" ? "qrc:/asset/img/avatar.png" : "image://mxc/" + avatar
2018-03-04 14:40:48 +00:00
opaqueBackground: true
2018-02-28 13:11:42 +00:00
}
2018-02-23 14:39:14 +00:00
2018-02-28 13:11:42 +00:00
Column {
2018-03-01 11:37:52 +00:00
width: parent.width - parent.height - parent.spacing
2018-02-28 13:11:42 +00:00
height: parent.height
Text {
width: parent.width
text: name
color: "#424242"
2018-03-01 11:37:52 +00:00
font.pointSize: 16
elide: Text.ElideRight
wrapMode: Text.NoWrap
2018-02-28 13:11:42 +00:00
}
Text {
width: parent.width
text: value
color: "#424242"
2018-03-01 11:37:52 +00:00
elide: Text.ElideRight
wrapMode: Text.NoWrap
2018-02-23 14:39:14 +00:00
}
}
}
}
}
}
}
}