make profile popup reusable
This commit is contained in:
parent
c79fa1e4cc
commit
e7e77f58dc
|
@ -7,6 +7,7 @@ import Qt.labs.platform 1.1
|
|||
import QtQml.Models 2.3
|
||||
import "../../../../shared"
|
||||
import "../../../../imports"
|
||||
import "../components"
|
||||
import "./samples/"
|
||||
|
||||
ScrollView {
|
||||
|
@ -24,6 +25,10 @@ ScrollView {
|
|||
ScrollBar.vertical.policy: chatLogView.contentHeight > chatLogView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
|
||||
ProfilePopup {
|
||||
id: profilePopup
|
||||
}
|
||||
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
spacing: 4
|
||||
|
@ -127,6 +132,7 @@ ScrollView {
|
|||
contentType: model.contentType
|
||||
authorCurrentMsg: msgDelegate.ListView.section
|
||||
authorPrevMsg: msgDelegate.ListView.previousSection
|
||||
profileClick: profilePopup.openPopup.bind(profilePopup)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ Item {
|
|||
property bool isMessage: contentType == Constants.messageType || contentType == Constants.stickerType || contentType == Constants.emojiType
|
||||
property bool isStatusMessage: contentType == Constants.systemMessagePrivateGroupType
|
||||
|
||||
property var profileClick: function () {}
|
||||
|
||||
width: parent.width
|
||||
height: {
|
||||
switch(contentType){
|
||||
|
@ -36,10 +38,6 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
ProfilePopup {
|
||||
id: profilePopup
|
||||
}
|
||||
|
||||
Item {
|
||||
id: channelIdentifier
|
||||
visible: authorCurrentMsg == ""
|
||||
|
@ -155,7 +153,6 @@ Item {
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
|
||||
// Messages
|
||||
Image {
|
||||
id: chatImage
|
||||
|
@ -173,7 +170,7 @@ Item {
|
|||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
profilePopup.open()
|
||||
profileClick(userName, fromAuthor, identicon)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +192,7 @@ Item {
|
|||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
profilePopup.open()
|
||||
profileClick(userName, fromAuthor, identicon)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,16 @@ import "./"
|
|||
|
||||
ModalPopup {
|
||||
id: popup
|
||||
property var identicon: ""
|
||||
property var userName: ""
|
||||
property var fromAuthor: ""
|
||||
|
||||
function openPopup(userNameParam, fromAuthorParam, identiconParam) {
|
||||
this.userName = userNameParam
|
||||
this.fromAuthor = fromAuthorParam
|
||||
this.identicon = identiconParam
|
||||
popup.open()
|
||||
}
|
||||
|
||||
header: Item {
|
||||
height: children[0].height
|
||||
|
|
Loading…
Reference in New Issue