From 70926fbeaf1bfaea5371c44fbd14bcbd95671a3b Mon Sep 17 00:00:00 2001 From: Simon Redman Date: Wed, 31 Oct 2018 08:47:06 -0600 Subject: [PATCH] [SMS App] Clean up runtime warning about undefined behavior Summary: Move ColumnLayout containing text elements inside of the graphical bounding rectangle Test Plan: Pre patch: - Launch messaging app - Open conversation - Notice huge spew of warnings like: "qrc:/qml/ChatMessage.qml:84:5: QML ColumnLayout: Detected anchors on an item that is managed by a layout. This is undefined behavior; use Layout.alignment instead." Post patch: - Launch messaging app - Open conversation - No warnings about undefined behavior Reviewers: apol Reviewed By: apol Subscribers: kdeconnect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D16534 --- smsapp/qml/ChatMessage.qml | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/smsapp/qml/ChatMessage.qml b/smsapp/qml/ChatMessage.qml index a37ba2895..38a6c0469 100644 --- a/smsapp/qml/ChatMessage.qml +++ b/smsapp/qml/ChatMessage.qml @@ -79,28 +79,27 @@ RowLayout { samples: 10 spread: 0.1 } - } - ColumnLayout { - id: content - spacing: 0 - anchors.centerIn: box + ColumnLayout { + id: content + spacing: 0 + anchors.centerIn: box - Controls.Label { - text: messageBody - textFormat: Text.PlainText - wrapMode: Text.Wrap - color: sentByMe ? Kirigami.Theme.buttonTextColor : Kirigami.Theme.complementaryTextColor - - Layout.maximumWidth: root.width - Kirigami.Units.gridUnit * 6 - } - - RowLayout { Controls.Label { - id: dateLabel - text: Qt.formatDateTime(dateTime, "dd. MMM yyyy, hh:mm") - color: Kirigami.Theme.disabledTextColor - font.pixelSize: Kirigami.Units.gridUnit * 0.8 + text: messageBody + textFormat: Text.PlainText + wrapMode: Text.Wrap + color: sentByMe ? Kirigami.Theme.buttonTextColor : Kirigami.Theme.complementaryTextColor + Layout.maximumWidth: root.width - Kirigami.Units.gridUnit * 6 + } + + RowLayout { + Controls.Label { + id: dateLabel + text: Qt.formatDateTime(dateTime, "dd. MMM yyyy, hh:mm") + color: Kirigami.Theme.disabledTextColor + font.pixelSize: Kirigami.Units.gridUnit * 0.8 + } } } }