Support Qt 5.11 and fix image provider.
This commit is contained in:
@@ -3,123 +3,171 @@ import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls.Material 2.3
|
||||
import QtGraphicalEffects 1.0
|
||||
import Matrique 0.1
|
||||
import "qrc:/qml/component"
|
||||
|
||||
Item {
|
||||
property int roomIndex
|
||||
id: item
|
||||
property var currentRoom
|
||||
|
||||
ColumnLayout {
|
||||
Pane {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
padding: 0
|
||||
|
||||
Pane {
|
||||
z: 10
|
||||
padding: 16
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 80
|
||||
|
||||
background: Rectangle {
|
||||
color: "#eaeaea"
|
||||
background: Item {
|
||||
anchors.fill: parent
|
||||
visible: currentRoom == null
|
||||
Pane {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
spacing: 16
|
||||
|
||||
ImageStatus {
|
||||
width: parent.height
|
||||
height: parent.height
|
||||
source: "qrc:/asset/img/avatar.png"
|
||||
}
|
||||
|
||||
Column {
|
||||
height: parent.height
|
||||
Text {
|
||||
text: "Astolfo"
|
||||
font.pointSize: 18
|
||||
color: "#424242"
|
||||
}
|
||||
Text {
|
||||
text: "Rider of Black"
|
||||
color: "#424242"
|
||||
}
|
||||
}
|
||||
Label {
|
||||
z: 10
|
||||
text: "Please choose a room."
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
Pane {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
|
||||
Pane {
|
||||
z: 10
|
||||
padding: 16
|
||||
visible: currentRoom != null
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 80
|
||||
Pane {
|
||||
z: 10
|
||||
padding: 16
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 80
|
||||
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: height
|
||||
Layout.fillHeight: true
|
||||
background: Rectangle {
|
||||
color: Material.theme == Material.Light ? "#eaeaea" : "#242424"
|
||||
}
|
||||
|
||||
contentItem: Text {
|
||||
text: "\ue226"
|
||||
// color: "#424242"
|
||||
font.pointSize: 16
|
||||
font.family: materialFont.name
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 16
|
||||
|
||||
ImageStatus {
|
||||
Layout.preferredWidth: parent.height
|
||||
Layout.fillHeight: true
|
||||
source: "qrc:/asset/img/avatar.png"
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: currentRoom != null ? currentRoom.name : ""
|
||||
font.pointSize: 16
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: currentRoom != null ? currentRoom.topic : ""
|
||||
elide: Text.ElideRight
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: messageListView
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.leftMargin: 16
|
||||
Layout.rightMargin: 16
|
||||
displayMarginBeginning: 40
|
||||
displayMarginEnd: 40
|
||||
verticalLayoutDirection: ListView.BottomToTop
|
||||
spacing: 12
|
||||
// model: MessageEventModel{ currentRoom: item.currentRoom }
|
||||
model: 10
|
||||
delegate: Row {
|
||||
readonly property bool sentByMe: index % 2 == 0
|
||||
|
||||
id: messageRow
|
||||
|
||||
height: 40
|
||||
anchors.right: sentByMe ? parent.right : undefined
|
||||
spacing: 6
|
||||
|
||||
Rectangle {
|
||||
id: avatar
|
||||
width: height
|
||||
height: parent.height
|
||||
color: "grey"
|
||||
visible: !sentByMe
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: Math.min(messageText.implicitWidth + 24,
|
||||
messageListView.width - (!sentByMe ? avatar.width + messageRow.spacing : 0))
|
||||
height: parent.height
|
||||
color: sentByMe ? "lightgrey" : Material.accent
|
||||
|
||||
Label {
|
||||
id: messageText
|
||||
text: index
|
||||
color: sentByMe ? "black" : "white"
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
wrapMode: Label.Wrap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
placeholderText: "Send a Message"
|
||||
leftPadding: 16
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
ScrollBar.vertical: ScrollBar { /*anchors.left: messageListView.right*/ }
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: "#eaeaea"
|
||||
}
|
||||
}
|
||||
Pane {
|
||||
z: 10
|
||||
padding: 16
|
||||
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: height
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 80
|
||||
|
||||
contentItem: Text {
|
||||
text: "\ue24e"
|
||||
// color: parent.pressed ? Material.accent : "#424242"
|
||||
font.pointSize: 16
|
||||
font.family: materialFont.name
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 0
|
||||
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: height
|
||||
Layout.fillHeight: true
|
||||
|
||||
contentItem: MaterialIcon { icon: "\ue226" }
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: "#eaeaea"
|
||||
TextField {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
placeholderText: "Send a Message"
|
||||
leftPadding: 16
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
selectByMouse: true
|
||||
|
||||
background: Rectangle {
|
||||
color: Material.theme == Material.Light ? "#eaeaea" : "#242424"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: height
|
||||
Layout.fillHeight: true
|
||||
ItemDelegate {
|
||||
Layout.preferredWidth: height
|
||||
Layout.fillHeight: true
|
||||
|
||||
contentItem: Text {
|
||||
text: "\ue163"
|
||||
// color: "#424242"
|
||||
font.pointSize: 16
|
||||
font.family: materialFont.name
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
contentItem: MaterialIcon { icon: "\ue24e" }
|
||||
|
||||
background: Rectangle {
|
||||
color: Material.theme == Material.Light ? "#eaeaea" : "#242424"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user