From c6a2a5e479692c1988caa9c82a8a8179587f3a67 Mon Sep 17 00:00:00 2001 From: gaelle Date: Tue, 25 Mar 2025 12:45:45 +0100 Subject: [PATCH] fix adaptative margins : set minimum margin --- Linphone/view/Page/Form/Login/LoginPage.qml | 2 +- .../view/Page/Form/Login/SIPLoginPage.qml | 86 ++++++++++++------- .../view/Page/Form/Register/RegisterPage.qml | 4 +- .../view/Page/Layout/Login/LoginLayout.qml | 9 +- Linphone/view/Page/Window/Main/MainWindow.qml | 2 +- 5 files changed, 62 insertions(+), 41 deletions(-) diff --git a/Linphone/view/Page/Form/Login/LoginPage.qml b/Linphone/view/Page/Form/Login/LoginPage.qml index e98d51134..4755f7c05 100644 --- a/Linphone/view/Page/Form/Login/LoginPage.qml +++ b/Linphone/view/Page/Form/Login/LoginPage.qml @@ -52,7 +52,7 @@ LoginLayout { RowLayout { visible: !SettingsCpp.assistantHideCreateAccount spacing: Math.round(20 * DefaultStyle.dp) - Layout.rightMargin: Math.round((51 - ((51/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp) + Layout.rightMargin: Math.round(Math.max(10 * DefaultStyle.dp, (51 - ((51/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp)) Text { Layout.rightMargin: Math.round(15 * DefaultStyle.dp) diff --git a/Linphone/view/Page/Form/Login/SIPLoginPage.qml b/Linphone/view/Page/Form/Login/SIPLoginPage.qml index 8833cc4ad..0869607a6 100644 --- a/Linphone/view/Page/Form/Login/SIPLoginPage.qml +++ b/Linphone/view/Page/Form/Login/SIPLoginPage.qml @@ -84,8 +84,13 @@ LoginLayout { contentHeight: content.implicitHeight clip: true flickableDirection: Flickable.VerticalFlick + + Control.ScrollBar.vertical: scrollbar + ColumnLayout { - id: content + id: content + // rightMargin is negative margin + width: parent.width - scrollbar.width*2 spacing: Math.round(85 * DefaultStyle.dp) ColumnLayout { spacing: 0 @@ -174,15 +179,19 @@ LoginLayout { Component { id: secondItem Flickable { + id: formFlickable width: parent.width contentWidth: content.implicitWidth contentHeight: content.implicitHeight clip: true flickableDirection: Flickable.VerticalFlick + + Control.ScrollBar.vertical: scrollbar + ColumnLayout { id: content spacing: Math.round(2 * DefaultStyle.dp) - width: Math.round(361 * DefaultStyle.dp) + width: formFlickable.width - scrollbar.width*2 ColumnLayout { spacing: Math.round(8 * DefaultStyle.dp) @@ -248,27 +257,27 @@ LoginLayout { KeyNavigation.down: transportCbox } } - } - FormItemLayout { - //: "Transport" - label: qsTr("transport") - Layout.fillWidth: true - contentItem: ComboBox { - id: transportCbox - height: Math.round(49 * DefaultStyle.dp) - width: Math.round(360 * DefaultStyle.dp) - textRole: "text" - valueRole: "value" - model: [ - {text: "TCP", value: LinphoneEnums.TransportType.Tcp}, - {text: "UDP", value: LinphoneEnums.TransportType.Udp}, - {text: "TLS", value: LinphoneEnums.TransportType.Tls}, - {text: "DTLS", value: LinphoneEnums.TransportType.Dtls} - ] - currentIndex: Utils.findIndex(model, function (entry) { - return entry.text === SettingsCpp.assistantThirdPartySipAccountTransport.toUpperCase() - }) - } + FormItemLayout { + //: "Transport" + label: qsTr("transport") + Layout.fillWidth: true + contentItem: ComboBox { + id: transportCbox + height: Math.round(49 * DefaultStyle.dp) + width: Math.round(360 * DefaultStyle.dp) + textRole: "text" + valueRole: "value" + model: [ + {text: "TCP", value: LinphoneEnums.TransportType.Tcp}, + {text: "UDP", value: LinphoneEnums.TransportType.Udp}, + {text: "TLS", value: LinphoneEnums.TransportType.Tls}, + {text: "DTLS", value: LinphoneEnums.TransportType.Dtls} + ] + currentIndex: Utils.findIndex(model, function (entry) { + return entry.text === SettingsCpp.assistantThirdPartySipAccountTransport.toUpperCase() + }) + } + } } TemporaryText { @@ -362,15 +371,28 @@ LoginLayout { } centerContent: [ - Control.StackView { - id: rootStackView - initialItem: SettingsCpp.assistantGoDirectlyToThirdPartySipAccountLogin ? secondItem : firstItem - anchors.top: parent.top - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.leftMargin: Math.round(127 * DefaultStyle.dp) - width: Math.round(361 * DefaultStyle.dp) - }, + Item { + anchors.fill: parent + Control.StackView { + id: rootStackView + initialItem: SettingsCpp.assistantGoDirectlyToThirdPartySipAccountLogin ? secondItem : firstItem + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.leftMargin: Math.round(127 * DefaultStyle.dp) + width: Math.round(361 * DefaultStyle.dp) + } + ScrollBar { + id: scrollbar + z: 1 + active: true + interactive: true + parent: rootStackView.currentItem + visible: parent.contentHeight > parent.height + policy: Control.ScrollBar.AsNeeded + anchors.rightMargin: -8 * DefaultStyle.dp + } + }, Image { z: -1 anchors.top: parent.top diff --git a/Linphone/view/Page/Form/Register/RegisterPage.qml b/Linphone/view/Page/Form/Register/RegisterPage.qml index 5d340c390..303c55389 100644 --- a/Linphone/view/Page/Form/Register/RegisterPage.qml +++ b/Linphone/view/Page/Form/Register/RegisterPage.qml @@ -66,7 +66,7 @@ LoginLayout { }, RowLayout { spacing: Math.round(20 * DefaultStyle.dp) - Layout.rightMargin: Math.round((51 - ((51/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp) + Layout.rightMargin: Math.round(Math.max(10 * DefaultStyle.dp,(51 - ((51/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp)) Text { Layout.rightMargin: Math.round(15 * DefaultStyle.dp) color: DefaultStyle.main2_700 @@ -98,7 +98,7 @@ LoginLayout { TabBar { Layout.fillWidth: true id: bar - Layout.rightMargin: Math.round((127 - ((127/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp) + Layout.rightMargin: Math.round(Math.max(5 * DefaultStyle.dp,(127 - ((127/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp)) // "S'inscrire avec un numéro de téléphone" model: [qsTr("assistant_account_register_with_phone_number"), // "S'inscrire avec un email" diff --git a/Linphone/view/Page/Layout/Login/LoginLayout.qml b/Linphone/view/Page/Layout/Login/LoginLayout.qml index f038457c9..2005b7f2a 100644 --- a/Linphone/view/Page/Layout/Login/LoginLayout.qml +++ b/Linphone/view/Page/Layout/Login/LoginLayout.qml @@ -123,13 +123,12 @@ Rectangle { } ColumnLayout { - id: contentLayout anchors.fill: parent spacing: 0 RowLayout { Layout.fillWidth: true - Layout.topMargin: Math.round((25 - ((25/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height))) * DefaultStyle.dp) - Layout.rightMargin: Math.round((42 - ((42/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp) + Layout.topMargin: Math.round(Math.max(5 * DefaultStyle.dp,(25 - ((25/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height))) * DefaultStyle.dp)) + Layout.rightMargin: Math.round(Math.max(5 * DefaultStyle.dp,(42 - ((42/(DefaultStyle.defaultWidth - mainWindow.minimumWidth))*(DefaultStyle.defaultWidth-mainWindow.width))) * DefaultStyle.dp)) spacing: 0 Item { Layout.fillWidth: true @@ -150,14 +149,14 @@ Rectangle { RowLayout { id: titleLayout Layout.fillWidth: true - Layout.topMargin: Math.round((40 - ((40/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height))) * DefaultStyle.dp) + Layout.topMargin: Math.round(Math.max(10 * DefaultStyle.dp,(40 - ((40/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height))) * DefaultStyle.dp)) spacing: 0 } Item { id: centerLayout Layout.fillHeight: true Layout.fillWidth: true - Layout.topMargin: Math.round((70 - ((70/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height))) * DefaultStyle.dp) + Layout.topMargin: Math.round(Math.max(15 * DefaultStyle.dp,(70 - ((70/(DefaultStyle.defaultHeight - mainWindow.minimumHeight))*(DefaultStyle.defaultHeight-mainWindow.height))) * DefaultStyle.dp)) Layout.alignment: Qt.AlignBottom } diff --git a/Linphone/view/Page/Window/Main/MainWindow.qml b/Linphone/view/Page/Window/Main/MainWindow.qml index af856075d..1825420d4 100644 --- a/Linphone/view/Page/Window/Main/MainWindow.qml +++ b/Linphone/view/Page/Window/Main/MainWindow.qml @@ -22,7 +22,7 @@ AbstractWindow { color: DefaultStyle.grey_0 minimumWidth: Math.round(1020 * DefaultStyle.dp) - minimumHeight: Math.round(735 * DefaultStyle.dp) + minimumHeight: Math.round(700 * DefaultStyle.dp) signal callCreated() property var accountProxy