1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-03 22:35:45 +02:00

misc: fit edited message to area

Change-Id: I019fba4105bde11d049d64a8e94716c0e977f79e
GitLab: #1001
This commit is contained in:
Aline Gondim Santos 2023-02-27 15:38:27 -03:00
parent 10e4b63414
commit eaec313a3c
4 changed files with 17 additions and 3 deletions

View file

@ -116,7 +116,8 @@ Rectangle {
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: footerColumnLayout.width
Layout.maximumWidth: JamiTheme.chatViewMaximumWidth
Layout.preferredHeight: 36
Layout.minimumHeight: 36
Layout.preferredHeight: 36 * JamiTheme.baseZoom
visible: MessagesAdapter.replyToId !== ""
}
@ -126,7 +127,8 @@ Rectangle {
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: footerColumnLayout.width
Layout.maximumWidth: JamiTheme.chatViewMaximumWidth
Layout.preferredHeight: 36
Layout.minimumHeight: 36
Layout.preferredHeight: 36 * JamiTheme.baseZoom
visible: MessagesAdapter.editId !== ""
}

View file

@ -65,7 +65,7 @@ Rectangle {
id: metrics
elide: Text.ElideRight
elideWidth: root.width - 100
text: root.body
text: UtilsAdapter.getOneline(root.body)
}
text: metrics.elidedText

View file

@ -735,3 +735,13 @@ UtilsAdapter::hasNativeDarkTheme() const
#endif
#endif
}
QString
UtilsAdapter::getOneline(const QString& input)
{
auto output = input;
auto index = output.indexOf("\n");
if (index > 0)
output.truncate(index);
return output;
}

View file

@ -139,6 +139,8 @@ public:
Q_INVOKABLE bool useApplicationTheme();
Q_INVOKABLE bool hasNativeDarkTheme() const;
Q_INVOKABLE QString getOneline(const QString& input);
Q_SIGNALS:
void debugMessageReceived(const QString& message);
void changeFontSize();