Changeset View
Changeset View
Standalone View
Standalone View
src/contents/ui/event-types/Simple.qml
Show All 12 Lines | |||||
import '..' as Kazv | import '..' as Kazv | ||||
ColumnLayout { | ColumnLayout { | ||||
property var event | property var event | ||||
property var sender | property var sender | ||||
default property var children | default property var children | ||||
property var isSelected | property var isSelected | ||||
/// The item shown after the username, in compact mode | |||||
property var summaryItem: Item {} | |||||
property var nameProvider: Kazv.UserNameProvider { | property var nameProvider: Kazv.UserNameProvider { | ||||
user: sender | user: sender | ||||
} | } | ||||
property var senderNickname: nameProvider.name | property var senderNickname: nameProvider.name | ||||
property var contentMaxWidth: { | property var contentMaxWidth: { | ||||
(parent.width | (parent.width | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | ColumnLayout { | ||||
name: senderNickname | name: senderNickname | ||||
visible: compactMode | visible: compactMode | ||||
} | } | ||||
Label { | Label { | ||||
id: userNicknameText | id: userNicknameText | ||||
objectName: 'userNicknameText' | objectName: 'userNicknameText' | ||||
text: senderNickname | text: senderNickname | ||||
Layout.fillWidth: true | Layout.fillWidth: !compactMode | ||||
property var reasonableWidth: Math.max(contentWidth, Kirigami.Units.gridUnit) | property var reasonableWidth: Math.max(contentWidth, Kirigami.Units.gridUnit) | ||||
TapHandler { | TapHandler { | ||||
enabled: !compactMode | enabled: !compactMode | ||||
onTapped: { | onTapped: { | ||||
if (point.position.x <= userNicknameText.reasonableWidth) { | if (point.position.x <= userNicknameText.reasonableWidth) { | ||||
mentionUserRequested(sender.userId); | mentionUserRequested(sender.userId); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | |||||
RowLayout { | |||||
objectName: 'compactModeSummary' | |||||
visible: compactMode | |||||
data: [summaryItem] | |||||
} | } | ||||
} | } | ||||
RowLayout { | RowLayout { | ||||
id: container | id: container | ||||
Layout.fillWidth: true | Layout.fillWidth: true | ||||
data: layout.children | data: layout.children | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } |