matrixion/resources/qml/delegates/Redacted.qml

51 lines
1.6 KiB
QML
Raw Normal View History

2021-11-29 03:59:57 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
2021-11-29 03:59:57 +03:00
//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import im.nheko 1.0
Rectangle{
2021-11-29 05:10:35 +03:00
height: redactedLayout.implicitHeight + Nheko.paddingSmall
implicitWidth: redactedLayout.implicitWidth + 2 * Nheko.paddingMedium
2022-02-14 16:03:17 +03:00
width: parent.width
2021-11-29 03:59:57 +03:00
radius: fontMetrics.lineSpacing / 2 + 2 * Nheko.paddingSmall
color: Nheko.colors.alternateBase
RowLayout {
id: redactedLayout
anchors.centerIn: parent
2021-11-29 05:10:35 +03:00
spacing: Nheko.paddingSmall
2021-11-29 03:59:57 +03:00
Image {
id: trashImg
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
Layout.preferredWidth: fontMetrics.font.pixelSize
Layout.preferredHeight: fontMetrics.font.pixelSize
source: "image://colorimage/:/icons/icons/ui/delete.svg?" + Nheko.colors.text
}
Label {
id: redactedLabel
2021-11-29 05:10:35 +03:00
Layout.margins: 0
2021-11-29 03:59:57 +03:00
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
Layout.preferredWidth: implicitWidth
//Layout.fillWidth: true
//Layout.maximumWidth: delegateWidth - 4 * Nheko.paddingSmall - trashImg.width - 2 * Nheko.paddingMedium
2021-11-29 03:59:57 +03:00
property var redactedPair: room.formatRedactedEvent(eventId)
text: redactedPair["first"]
wrapMode: Label.WordWrap
2021-11-29 05:10:35 +03:00
color: Nheko.colors.text
2021-11-29 03:59:57 +03:00
ToolTip.text: redactedPair["second"]
ToolTip.visible: hh.hovered
HoverHandler {
id: hh
}
}
}
2021-11-29 05:10:35 +03:00
}