Qt World Summit Conference App
import QtQuick 2.0
import Felgo 3.0
SocialUserDelegate {
id: cell
height: userImageWithDoubleColumnText.height + dp(16)
property bool seperator: true
property var defaultAction
property alias actionButton: actionButton
property alias text: userImageWithDoubleColumnText.text
property alias subtext: userImageWithDoubleColumnText.subtext
property alias userImageSource: userImageWithDoubleColumnText.userImageSource
property alias locale: userImageWithDoubleColumnText.locale
property var userCustomData: modelData.customData ? JSON.parse(modelData.customData) : ({})
function getCustomDataString(fieldName) {
return userCustomData[fieldName] ? userCustomData[fieldName] : ""
}
Rectangle {
anchors.fill: parent
color: "#ffffffff"
}
UserImageWithDoubleColumnText {
id: userImageWithDoubleColumnText
text: modelData.text
details: {
var detail = []
if(getCustomDataString("companyName") !== "")
detail.push({"text" : getCustomDataString("companyName"), "icon" : IconType.building})
if(getCustomDataString("jobFunction") !== "")
detail.push({"text" : getCustomDataString("jobFunction"), "icon" : IconType.suitcase})
if(getCustomDataString("qtInterest") !== "")
detail.push({"text" : getCustomDataString("qtInterest"), "icon" : IconType.tag})
if(getCustomDataString("qtExperience") !== "")
detail.push({"text" : getCustomDataString("qtExperience"), "icon" : IconType.graduationcap})
return detail
}
subtext: modelData['subText'] !== undefined ? modelData.subText: ""
userImageSource: modelData && modelData.profile_picture || ""
locale: modelData && modelData.locale || ""
anchors.left: parent.left
anchors.right: actionButton.action !== undefined ? actionButton.left : parent.right
anchors.leftMargin: x
anchors.rightMargin: x
anchors.verticalCenter: parent.verticalCenter
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
parentPage.userSelected(gameNetworkUser, modelData)
}
onPressed: {
cell.opacity = 0.75
}
onReleased: {
cell.opacity = 1
}
onCanceled: {
cell.opacity = 1
}
}
SocialActionButton{
id: actionButton
anchors.right: cell.right
textSize: sp(15)
anchors.rightMargin: dp(16)
anchors.verticalCenter: cell.verticalCenter
property var action: modelData.action === undefined ? defaultAction : modelData.action
onClicked: {
if(actionButton.action.text===qsTr("Accept")) {
actionButton.enabled = false
gameNetworkItem.sendFriendResponse(gameNetworkUser.userId, function(success) {
actionButton.visible = false
if(!!parentPage)
parentPage.searchUsers()
})
}
}
onActionChanged: {
if(action !== undefined){
visible = action
text = action.text
backgroundColor = action['backgroundColor'] ? action.backgroundColor : socialViewItem.tintLightColor
}
}
}
Rectangle{
visible: seperator
height: 1
width: parent.width
anchors.bottom: parent.bottom