Commit 09ee28b0 authored by Black Hat's avatar Black Hat

Improve responsive and add dummy example of QtQuick chat.

parent 24df720f
......@@ -11,6 +11,7 @@ import "qrc:/qml/component"
Item {
property alias listModel: delegateModel.model
property alias currentIndex: listView.currentIndex
readonly property bool mini: width <= 80 // Used as an indicator of whether the listform should be displayed as "Mini mode".
DelegateModel {
id: delegateModel
......@@ -39,14 +40,7 @@ Item {
}
Column {
width: {
if (parent.width > 80) {
return parent.width - parent.height - parent.spacing;
} else {
return 0;
}
}
width: mini ? 0 : parent.width - parent.height - parent.spacing
height: parent.height
Text {
......@@ -95,7 +89,7 @@ Item {
id: searchField
width: parent.width
height: 36
leftPadding: width > 80 ? 16 : 4
leftPadding: mini ? 4 : 16
topPadding: 0
bottomPadding: 0
anchors.verticalCenter: parent.verticalCenter
......@@ -107,13 +101,13 @@ Item {
MaterialIcon {
icon: "\ue8b6"
width: searchField.width > 80 ? parent.height : parent.width
width: mini ? parent.width : parent.height
height: parent.height
}
Text {
height: parent.height
visible: searchField.width > 80
visible: !mini
text: "Search"
color: "white"
font.pointSize: 12
......@@ -153,7 +147,7 @@ Item {
Text {
z: 10
text: parent.width > 80 ? "Here? No, not here." : "Empty"
text: mini ? "Empty" : "Here? No, not here."
color: "#424242"
anchors.centerIn: parent
visible: listView.count === 0
......
......@@ -52,9 +52,42 @@ Item {
}
}
Pane {
ListView {
Layout.fillWidth: true
Layout.fillHeight: true
displayMarginBeginning: 40
displayMarginEnd: 40
verticalLayoutDirection: ListView.BottomToTop
spacing: 12
model: 10
delegate: Row {
readonly property bool sentByMe: index % 2 == 0
anchors.right: sentByMe ? parent.right : undefined
spacing: 6
Rectangle {
id: avatar
width: height
height: parent.height
color: "grey"
visible: !sentByMe
}
Rectangle {
width: 80
height: 40
color: sentByMe ? "lightgrey" : "steelblue"
Label {
anchors.centerIn: parent
text: index
color: sentByMe ? "black" : "white"
}
}
}
ScrollBar.vertical: ScrollBar {}
}
Pane {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment