You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nheko/qml/ElidedLabel.qml

33 lines
885 B

// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.9
import QtQuick.Controls 2.5
import im.nheko
Label {
id: root
property alias elideWidth: metrics.elideWidth
3 years ago
property alias fullText: metrics.text
property int fullTextWidth: Math.ceil(metrics2.advanceWidth + 4)
color: timelineRoot.palette.text
elide: Text.ElideRight
3 years ago
maximumLineCount: 1
text: (textFormat == Text.PlainText) ? metrics.elidedText : TimelineManager.escapeEmoji(TimelineManager.htmlEscape(metrics.elidedText))
textFormat: Text.PlainText
TextMetrics {
id: metrics
elide: Text.ElideRight
3 years ago
font: root.font
}
TextMetrics {
id: metrics2
//elide: Text.ElideRight
font: root.font
text: metrics.text
}
}