From 0e1748b705709e5940babae9abdf5065535797da Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 2 May 2017 12:55:37 +0200 Subject: [PATCH] Small layout fix so the comboboxes are aligned --- resources/qml/Preferences/GeneralPage.qml | 133 ++++++++++------------ 1 file changed, 60 insertions(+), 73 deletions(-) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 85039b3c32..689f7aafa9 100755 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -126,9 +126,11 @@ UM.PreferencesPage text: catalog.i18nc("@label","Interface") } - Row + GridLayout { - spacing: UM.Theme.getSize("default_margin").width + id: interfaceGrid + columns: 4 + Label { id: languageLabel @@ -189,94 +191,79 @@ UM.PreferencesPage { id: currencyLabel text: catalog.i18nc("@label","Currency:") - anchors.verticalCenter: languageComboBox.verticalCenter + anchors.verticalCenter: currencyField.verticalCenter } + TextField { id: currencyField text: UM.Preferences.getValue("cura/currency") onTextChanged: UM.Preferences.setValue("cura/currency", text) } + + Label + { + id: themeLabel + text: catalog.i18nc("@label","Theme:") + anchors.verticalCenter: themeComboBox.verticalCenter + } + + ComboBox + { + id: themeComboBox + + model: ListModel + { + id: themeList + + Component.onCompleted: { + append({ text: catalog.i18nc("@item:inlistbox", "Ultimaker"), code: "cura" }) + } + } + + currentIndex: + { + var code = UM.Preferences.getValue("general/theme"); + for(var i = 0; i < themeList.count; ++i) + { + if(model.get(i).code == code) + { + return i + } + } + } + onActivated: UM.Preferences.setValue("general/theme", model.get(index).code) + + Component.onCompleted: + { + // Because ListModel is stupid and does not allow using qsTr() for values. + for(var i = 0; i < themeList.count; ++i) + { + themeList.setProperty(i, "text", catalog.i18n(themeList.get(i).text)); + } + + // Glorious hack time. ComboBox does not update the text properly after changing the + // model. So change the indices around to force it to update. + currentIndex += 1; + currentIndex -= 1; + } + + } } - Label + + + + Label { id: languageCaption //: Language change warning - text: catalog.i18nc("@label", "You will need to restart the application for language changes to have effect.") + text: catalog.i18nc("@label", "You will need to restart the application for these changes to have effect.") wrapMode: Text.WordWrap font.italic: true } - Item - { - //: Spacer - height: UM.Theme.getSize("default_margin").height - width: UM.Theme.getSize("default_margin").width - } - - Row - { - spacing: UM.Theme.getSize("default_margin").width - Label - { - id: themeLabel - text: catalog.i18nc("@label","Theme:") - anchors.verticalCenter: themeComboBox.verticalCenter - } - - ComboBox - { - id: themeComboBox - model: ListModel - { - id: themeList - - Component.onCompleted: { - append({ text: catalog.i18nc("@item:inlistbox", "Ultimaker"), code: "cura" }) - } - } - - currentIndex: - { - var code = UM.Preferences.getValue("general/theme"); - for(var i = 0; i < themeList.count; ++i) - { - if(model.get(i).code == code) - { - return i - } - } - } - onActivated: UM.Preferences.setValue("general/theme", model.get(index).code) - - Component.onCompleted: - { - // Because ListModel is stupid and does not allow using qsTr() for values. - for(var i = 0; i < themeList.count; ++i) - { - themeList.setProperty(i, "text", catalog.i18n(themeList.get(i).text)); - } - - // Glorious hack time. ComboBox does not update the text properly after changing the - // model. So change the indices around to force it to update. - currentIndex += 1; - currentIndex -= 1; - } - } - } - - Label - { - id: themeCaption - - //: Theme change warning - text: catalog.i18nc("@label", "You will need to restart the application for theme changes to have effect.") - wrapMode: Text.WordWrap - font.italic: true - } - Item { //: Spacer