From 45f1060da068d2781cf8f922709f839fe81881aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 20 May 2014 15:31:03 +0200 Subject: [PATCH] [kcmkwin/compositing] Set a maximumWidth on the text elements in Effect By properly setting Layout.maximumWidth the buttons are not moved out of the layout. Instead the text wraps to a new line. BUG: 335078 REVIEW: 118222 --- kcmkwin/kwincompositing/qml/Effect.qml | 91 +++++++++++++++----------- 1 file changed, 52 insertions(+), 39 deletions(-) diff --git a/kcmkwin/kwincompositing/qml/Effect.qml b/kcmkwin/kwincompositing/qml/Effect.qml index 8848cc06cd..8478fc82e2 100644 --- a/kcmkwin/kwincompositing/qml/Effect.qml +++ b/kcmkwin/kwincompositing/qml/Effect.qml @@ -41,72 +41,85 @@ Rectangle { RowLayout { id: rowEffect - width: parent.width - 2 * spacing + property int maximumWidth: parent.width - 2 * spacing + width: maximumWidth + Layout.maximumWidth: maximumWidth x: spacing - RadioButton { - id: exclusiveGroupButton - property bool exclusive: model.ExclusiveRole != "" - visible: exclusive - checked: model.EffectStatusRole - property bool actuallyChanged: true - property bool initiallyChecked: false - exclusiveGroup: exclusive ? effectView.exclusiveGroupForCategory(model.ExclusiveRole) : null - onCheckedChanged: { - if (!visible) { - return; + RowLayout { + id: checkBoxLayout + RadioButton { + id: exclusiveGroupButton + property bool exclusive: model.ExclusiveRole != "" + visible: exclusive + checked: model.EffectStatusRole + property bool actuallyChanged: true + property bool initiallyChecked: false + exclusiveGroup: exclusive ? effectView.exclusiveGroupForCategory(model.ExclusiveRole) : null + onCheckedChanged: { + if (!visible) { + return; + } + actuallyChanged = true; + item.checked = exclusiveGroupButton.checked + item.changed(); } - actuallyChanged = true; - item.checked = exclusiveGroupButton.checked - item.changed(); - } - onClicked: { - if (!actuallyChanged || initiallyChecked) { - checked = false; + onClicked: { + if (!actuallyChanged || initiallyChecked) { + checked = false; + } + actuallyChanged = false; + initiallyChecked = false; + } + Component.onCompleted: { + exclusiveGroupButton.initiallyChecked = model.EffectStatusRole; } - actuallyChanged = false; - initiallyChecked = false; } - Component.onCompleted: { - exclusiveGroupButton.initiallyChecked = model.EffectStatusRole; - } - } - CheckBox { - id: effectStatusCheckBox - checked: model.EffectStatusRole - visible: model.ExclusiveRole == "" + CheckBox { + id: effectStatusCheckBox + checked: model.EffectStatusRole + visible: model.ExclusiveRole == "" - onCheckedChanged: { - if (!visible) { - return; + onCheckedChanged: { + if (!visible) { + return; + } + item.checked = effectStatusCheckBox.checked; + item.changed(); } - item.checked = effectStatusCheckBox.checked; - item.changed(); - } - Connections { - target: searchModel - onDataChanged: { - effectStatusCheckBox.checked = model.EffectStatusRole; + Connections { + target: searchModel + onDataChanged: { + effectStatusCheckBox.checked = model.EffectStatusRole; + } } } } ColumnLayout { id: effectItem + property int maximumWidth: parent.maximumWidth - checkBoxLayout.width - (videoButton.width + configureButton.width + aboutButton.width) - parent.spacing * 5 + Layout.maximumWidth: maximumWidth Text { text: model.NameRole font.bold: true + wrapMode: Text.Wrap + Layout.maximumWidth: parent.maximumWidth } Text { id: desc text: model.DescriptionRole + wrapMode: Text.Wrap + Layout.maximumWidth: parent.maximumWidth } Text { id:aboutItem text: i18n("Author: %1\nLicense: %2", model.AuthorNameRole, model.LicenseRole) font.bold: true visible: false + wrapMode: Text.Wrap + Layout.maximumWidth: parent.maximumWidth } Video { id: videoItem