fix adaptative margins : set minimum margin

This commit is contained in:
gaelle 2025-03-25 12:45:45 +01:00
parent 4cc1665279
commit c6a2a5e479
5 changed files with 62 additions and 41 deletions

View file

@ -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)

View file

@ -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

View file

@ -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"

View file

@ -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
}

View file

@ -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