matrixion/resources/qml/ElidedLabel.qml

29 lines
683 B
QML
Raw Permalink Normal View History

// SPDX-FileCopyrightText: Nheko Contributors
2021-05-19 20:34:10 +03:00
//
// SPDX-License-Identifier: GPL-3.0-or-later
import QtQuick 2.9
2021-06-13 02:48:11 +03:00
import QtQuick.Controls 2.5
2021-05-19 20:34:10 +03:00
import im.nheko 1.0
Label {
id: root
property alias elideWidth: metrics.elideWidth
2023-06-02 02:45:24 +03:00
property alias fullText: metrics.text
property int fullTextWidth: Math.ceil(metrics.advanceWidth)
2021-05-19 20:34:10 +03:00
color: palette.text
2021-05-19 20:34:10 +03:00
elide: Text.ElideRight
2023-06-02 02:45:24 +03:00
maximumLineCount: 1
text: (textFormat == Text.PlainText) ? metrics.elidedText : TimelineManager.escapeEmoji(metrics.elidedText)
2021-05-19 20:34:10 +03:00
textFormat: Text.PlainText
TextMetrics {
id: metrics
elide: Text.ElideRight
2023-06-02 02:45:24 +03:00
font.pointSize: root.font.pointSize
2021-05-19 20:34:10 +03:00
}
}