From a79bf21a275d0897811c2b91d245ff09f3cb7678 Mon Sep 17 00:00:00 2001 From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com> Date: Fri, 11 Sep 2020 14:26:43 -0400 Subject: [PATCH] misc: resolve qml warnings present on application start - Resolves a portion of the warnings present prior to navigation or resizing. Gitlab: #5 Change-Id: Ifa843d7613ddcca562256399a977c2eec62df404 --- src/commoncomponents/ElidedTextLabel.qml | 10 ++++++++- src/mainview/MainView.qml | 9 ++++---- src/mainview/components/CallOverlay.qml | 6 +++++- src/mainview/components/VideoCallPage.qml | 2 +- .../components/WelcomePageQrDialog.qml | 6 +++++- src/settingsview/SettingsView.qml | 8 +++---- .../components/AdvancedSDPSettings.qml | 21 +++++++++---------- .../components/KeyBoardShortcutTable.qml | 16 ++++++++------ 8 files changed, 49 insertions(+), 29 deletions(-) diff --git a/src/commoncomponents/ElidedTextLabel.qml b/src/commoncomponents/ElidedTextLabel.qml index b94435db6..e448ceb29 100644 --- a/src/commoncomponents/ElidedTextLabel.qml +++ b/src/commoncomponents/ElidedTextLabel.qml @@ -20,11 +20,13 @@ import QtQuick 2.14 import QtQuick.Controls 1.4 import net.jami.Models 1.0 - Label { + id: root + property string eText : "" property int maxWidth: 100 property int fontSize: JamiTheme.textFontSize + property int textWidth: 0 font.pointSize: fontSize font.kerning: true @@ -37,8 +39,14 @@ Label { TextMetrics { id: elided + + font: root.font elide: Text.ElideRight elideWidth: maxWidth text: eText + + onTextChanged: { + textWidth = elided.boundingRect.width + } } } diff --git a/src/mainview/MainView.qml b/src/mainview/MainView.qml index 9085882a1..58a22578d 100644 --- a/src/mainview/MainView.qml +++ b/src/mainview/MainView.qml @@ -301,6 +301,7 @@ Window { Rectangle { id: mainViewSidePanelRect + SplitView.minimumWidth: sidePanelViewStackPreferredWidth SplitView.maximumWidth: (sidePanelHidden ? splitView.width : splitView.width - sidePanelViewStackPreferredWidth) @@ -404,6 +405,7 @@ Window { LeftPanelView { id: leftPanelSettingsView + visible: false contentViewportWidth: mainViewSidePanelRect.width contentViewPortHeight: mainViewSidePanelRect.height @@ -600,10 +602,9 @@ Window { } Component.onCompleted: { - - sidePanelViewStack.SplitView.maximumWidth = Qt.binding(function() { - return (sidePanelHidden ? splitView.width : - splitView.width - sidePanelViewStackPreferredWidth) + mainViewSidePanelRect.SplitView.maximumWidth = Qt.binding(function() { + return sidePanelHidden ? splitView.width : + splitView.width - sidePanelViewStackPreferredWidth }) recordBox.x = Qt.binding(function() { diff --git a/src/mainview/components/CallOverlay.qml b/src/mainview/components/CallOverlay.qml index 764a50d36..2a48c7912 100644 --- a/src/mainview/components/CallOverlay.qml +++ b/src/mainview/components/CallOverlay.qml @@ -195,7 +195,11 @@ Rectangle { TextMetrics { id: textMetricsjamiBestNameText font: jamiBestNameText.font - text: videoCallPageRect.bestName + text: { + if (videoCallPageRect) + return videoCallPageRect.bestName + return "" + } elideWidth: overlayUpperPartRect.width / 3 elide: Qt.ElideRight } diff --git a/src/mainview/components/VideoCallPage.qml b/src/mainview/components/VideoCallPage.qml index 46e19297b..316c893ce 100644 --- a/src/mainview/components/VideoCallPage.qml +++ b/src/mainview/components/VideoCallPage.qml @@ -222,7 +222,7 @@ Rectangle { DistantRenderer { id: distantRenderer - anchors.centerIn: videoCallPageMainRect + anchors.centerIn: parent z: -1 width: videoCallPageMainRect.width diff --git a/src/mainview/components/WelcomePageQrDialog.qml b/src/mainview/components/WelcomePageQrDialog.qml index 313c7d4e2..c2671b46d 100644 --- a/src/mainview/components/WelcomePageQrDialog.qml +++ b/src/mainview/components/WelcomePageQrDialog.qml @@ -42,7 +42,11 @@ Dialog { smooth: false fillMode: Image.PreserveAspectFit - source: "image://qrImage/account_" + AccountAdapter.currentAccountId + source: { + if (AccountAdapter.currentAccountId) + return "image://qrImage/account_" + AccountAdapter.currentAccountId + return "" + } } background: Rectangle { diff --git a/src/settingsview/SettingsView.qml b/src/settingsview/SettingsView.qml index 9e840faaa..9914c3708 100644 --- a/src/settingsview/SettingsView.qml +++ b/src/settingsview/SettingsView.qml @@ -180,7 +180,7 @@ Rectangle { Layout.fillHeight: true Layout.maximumWidth: JamiTheme.maximumWidthSettingsView - anchors.centerIn: parent + Layout.alignment: Qt.AlignCenter isSIP: settingsViewRect.isSIP @@ -199,7 +199,7 @@ Rectangle { Layout.fillHeight: true Layout.maximumWidth: JamiTheme.maximumWidthSettingsView - anchors.centerIn: parent + Layout.alignment: Qt.AlignCenter } // av setting page, index 2 @@ -208,7 +208,7 @@ Rectangle { Layout.fillHeight: true Layout.maximumWidth: JamiTheme.maximumWidthSettingsView - anchors.centerIn: parent + Layout.alignment: Qt.AlignCenter } // plugin setting page, index 3 @@ -216,7 +216,7 @@ Rectangle { id: pluginSettings Layout.fillHeight: true Layout.maximumWidth: JamiTheme.maximumWidthSettingsView - anchors.centerIn: parent + Layout.alignment: Qt.AlignCenter } } } diff --git a/src/settingsview/components/AdvancedSDPSettings.qml b/src/settingsview/components/AdvancedSDPSettings.qml index 87579b1ed..e680139cb 100644 --- a/src/settingsview/components/AdvancedSDPSettings.qml +++ b/src/settingsview/components/AdvancedSDPSettings.qml @@ -76,27 +76,26 @@ ColumnLayout { } ElidedTextLabel { - Layout.fillWidth: true + Layout.preferredWidth: textWidth Layout.preferredHeight: JamiTheme.preferredFieldHeight eText: JamiStrings.sdpSettingsTitle fontSize: JamiTheme.headerFontSize - maxWidth: width + maxWidth: root.width } - ElidedTextLabel { + ColumnLayout { Layout.fillWidth: true - Layout.preferredHeight: JamiTheme.preferredFieldHeight Layout.leftMargin: JamiTheme.preferredMarginSize - eText: JamiStrings.sdpSettingsSubtitle - fontSize: JamiTheme.settingsFontSize - maxWidth: width - } + ElidedTextLabel { + Layout.preferredWidth: textWidth + Layout.preferredHeight: JamiTheme.preferredFieldHeight - ColumnLayout { - Layout.fillWidth: true - Layout.leftMargin: JamiTheme.preferredMarginSize + eText: JamiStrings.sdpSettingsSubtitle + fontSize: JamiTheme.settingsFontSize + maxWidth: parent.width - JamiTheme.preferredMarginSize + } SettingSpinBox { id: audioRTPMinPortSpinBox diff --git a/src/settingsview/components/KeyBoardShortcutTable.qml b/src/settingsview/components/KeyBoardShortcutTable.qml index c6b0e7744..f62fb672c 100644 --- a/src/settingsview/components/KeyBoardShortcutTable.qml +++ b/src/settingsview/components/KeyBoardShortcutTable.qml @@ -558,8 +558,11 @@ Dialog { currentIndex: 0 TabButton { id: pageOne + width: tabBar.width / 2 - text: qsTr("1") + height: 30 + + text: "1" down: true // customize tab button contentItem: Text { @@ -573,8 +576,7 @@ Dialog { // customize tab button background: Rectangle { id: buttonRectOne - implicitWidth: tabBar.width / 2 - implicitHeight: tabBar.height + radius: 10 color: pageOne.down ? "#e0e0e0" :"#fdfdfd" MouseArea { @@ -589,8 +591,11 @@ Dialog { } TabButton { id: pageTwo - text: qsTr("2") + width: tabBar.width / 2 + height: 30 + + text: "2" contentItem: Text { text: pageTwo.text font: pageTwo.font @@ -602,8 +607,7 @@ Dialog { background: Rectangle { id: buttonRectTwo - implicitWidth: tabBar.width / 2 - implicitHeight: tabBar.height + radius: 10 color: pageTwo.down ? "#e0e0e0" :"#fdfdfd" MouseArea { -- GitLab