Adjust repeat combobox width when creating a rule

This commit is contained in:
Michael Zanetti 2023-05-02 21:54:26 +02:00
parent 1c901d4c7d
commit 08039189ee
2 changed files with 22 additions and 20 deletions

View File

@ -91,7 +91,7 @@ Page {
GridLayout { GridLayout {
columns: app.landscape ? 2 : 1 columns: app.landscape ? 2 : 1
Layout.alignment: app.landscape ? Qt.AlignHCenter : Qt.AlignLeft Layout.alignment: app.landscape ? Qt.AlignHCenter : Qt.AlignLeft
Layout.margins: app.margins Layout.margins: Style.margins
Layout.fillWidth: !app.landscape Layout.fillWidth: !app.landscape
Label { Label {
@ -131,7 +131,7 @@ Page {
RowLayout { RowLayout {
Layout.fillHeight: !app.landscape Layout.fillHeight: !app.landscape
Layout.topMargin: app.landscape ? app.margins : 0 Layout.topMargin: app.landscape ? Style.margins : 0
visible: root.isDateBased visible: root.isDateBased
ComboBox { ComboBox {
id: dayBox id: dayBox
@ -212,7 +212,7 @@ Page {
RowLayout { RowLayout {
Layout.fillHeight: !app.landscape Layout.fillHeight: !app.landscape
Layout.topMargin: app.landscape ? app.margins : 0 Layout.topMargin: app.landscape ? Style.margins : 0
visible: root.isDateBased visible: root.isDateBased
ComboBox { ComboBox {
id: toDayBox id: toDayBox
@ -263,15 +263,16 @@ Page {
Label { Label {
text: qsTr("Repeat") text: qsTr("Repeat")
Layout.topMargin: app.margins Layout.topMargin: Style.margins
} }
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: app.landscape ? app.margins : 0 Layout.topMargin: app.landscape ? Style.margins : 0
ComboBox { ComboBox {
id: repeatingBox id: repeatingBox
Layout.fillWidth: true
model: [qsTr("never"), qsTr("hourly"), qsTr("daily"), qsTr("weekly"), qsTr("monthly"), qsTr("yearly")] model: [qsTr("never"), qsTr("hourly"), qsTr("daily"), qsTr("weekly"), qsTr("monthly"), qsTr("yearly")]
currentIndex: { currentIndex: {
@ -298,7 +299,7 @@ Page {
Label { Label {
text: qsTr("Weekdays") text: qsTr("Weekdays")
Layout.topMargin: app.margins Layout.topMargin: Style.margins
visible: root.isWeekDayBased visible: root.isWeekDayBased
} }
@ -307,7 +308,7 @@ Page {
property var weekDays: root.calendarItem.repeatingOption.weekDays property var weekDays: root.calendarItem.repeatingOption.weekDays
visible: root.isWeekDayBased visible: root.isWeekDayBased
Layout.fillWidth: !app.landscape Layout.fillWidth: !app.landscape
Layout.topMargin: app.landscape ? app.margins : 0 Layout.topMargin: app.landscape ? Style.margins : 0
delegate: ToolButton { delegate: ToolButton {
text: model.shortName text: model.shortName
checked: weekDayRow.weekDays.indexOf(index + 1) >= 0 checked: weekDayRow.weekDays.indexOf(index + 1) >= 0
@ -327,7 +328,7 @@ Page {
Label { Label {
text: qsTr("Day of month") text: qsTr("Day of month")
Layout.topMargin: app.margins Layout.topMargin: Style.margins
visible: root.isMonthDayBased visible: root.isMonthDayBased
Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.alignment: Qt.AlignLeft | Qt.AlignTop
} }
@ -336,7 +337,7 @@ Page {
id: monthDayGrid id: monthDayGrid
columns: Math.sqrt(children.length) columns: Math.sqrt(children.length)
Layout.fillWidth: !app.landscape Layout.fillWidth: !app.landscape
Layout.topMargin: app.landscape ? app.margins : 0 Layout.topMargin: app.landscape ? Style.margins : 0
visible: root.isMonthDayBased visible: root.isMonthDayBased
property var monthDays: root.calendarItem.repeatingOption.monthDays property var monthDays: root.calendarItem.repeatingOption.monthDays
Repeater { Repeater {
@ -363,7 +364,7 @@ Page {
Button { Button {
Layout.fillWidth: !app.landscape Layout.fillWidth: !app.landscape
Layout.margins: app.margins Layout.margins: Style.margins
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
text: qsTr("OK") text: qsTr("OK")
onClicked: { onClicked: {

View File

@ -84,7 +84,7 @@ Page {
GridLayout { GridLayout {
columns: app.landscape ? 2 : 1 columns: app.landscape ? 2 : 1
Layout.alignment: app.landscape ? Qt.AlignHCenter : Qt.AlignLeft Layout.alignment: app.landscape ? Qt.AlignHCenter : Qt.AlignLeft
Layout.margins: app.margins Layout.margins: Style.margins
Layout.fillWidth: !app.landscape Layout.fillWidth: !app.landscape
Label { Label {
@ -124,15 +124,16 @@ Page {
Label { Label {
text: qsTr("Repeat") text: qsTr("Repeat")
Layout.topMargin: app.margins Layout.topMargin: Style.margins
} }
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: app.landscape ? app.margins : 0 Layout.topMargin: app.landscape ? Style.margins : 0
ComboBox { ComboBox {
id: repeatingBox id: repeatingBox
Layout.fillWidth: true
model: [qsTr("never"), qsTr("hourly"), qsTr("daily"), qsTr("weekly"), qsTr("monthly"), qsTr("yearly")] model: [qsTr("never"), qsTr("hourly"), qsTr("daily"), qsTr("weekly"), qsTr("monthly"), qsTr("yearly")]
currentIndex: { currentIndex: {
@ -158,13 +159,13 @@ Page {
Label { Label {
text: qsTr("Date") text: qsTr("Date")
Layout.topMargin: app.margins Layout.topMargin: Style.margins
visible: root.isDateBased visible: root.isDateBased
} }
RowLayout { RowLayout {
Layout.fillHeight: !app.landscape Layout.fillHeight: !app.landscape
Layout.topMargin: app.landscape ? app.margins : 0 Layout.topMargin: app.landscape ? Style.margins : 0
visible: root.isDateBased visible: root.isDateBased
ComboBox { ComboBox {
id: dayBox id: dayBox
@ -210,7 +211,7 @@ Page {
Label { Label {
text: qsTr("Weekdays") text: qsTr("Weekdays")
Layout.topMargin: app.margins Layout.topMargin: Style.margins
visible: root.isWeekDayBased visible: root.isWeekDayBased
} }
@ -219,7 +220,7 @@ Page {
property var weekDays: root.timeEventItem.repeatingOption.weekDays property var weekDays: root.timeEventItem.repeatingOption.weekDays
visible: root.isWeekDayBased visible: root.isWeekDayBased
Layout.fillWidth: !app.landscape Layout.fillWidth: !app.landscape
Layout.topMargin: app.landscape ? app.margins : 0 Layout.topMargin: app.landscape ? Style.margins : 0
delegate: ToolButton { delegate: ToolButton {
text: model.shortName text: model.shortName
checked: weekDayRow.weekDays.indexOf(index + 1) >= 0 checked: weekDayRow.weekDays.indexOf(index + 1) >= 0
@ -239,7 +240,7 @@ Page {
Label { Label {
text: qsTr("Day of month") text: qsTr("Day of month")
Layout.topMargin: app.margins Layout.topMargin: Style.margins
visible: root.isMonthDayBased visible: root.isMonthDayBased
Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.alignment: Qt.AlignLeft | Qt.AlignTop
} }
@ -248,7 +249,7 @@ Page {
id: monthDayGrid id: monthDayGrid
columns: Math.sqrt(children.length) columns: Math.sqrt(children.length)
Layout.fillWidth: !app.landscape Layout.fillWidth: !app.landscape
Layout.topMargin: app.landscape ? app.margins : 0 Layout.topMargin: app.landscape ? Style.margins : 0
visible: root.isMonthDayBased visible: root.isMonthDayBased
property var monthDays: root.timeEventItem.repeatingOption.monthDays property var monthDays: root.timeEventItem.repeatingOption.monthDays
Repeater { Repeater {
@ -275,7 +276,7 @@ Page {
Button { Button {
Layout.fillWidth: !app.landscape Layout.fillWidth: !app.landscape
Layout.margins: app.margins Layout.margins: Style.margins
Layout.alignment: Qt.AlignRight Layout.alignment: Qt.AlignRight
text: qsTr("OK") text: qsTr("OK")
onClicked: { onClicked: {