Changeset View
Changeset View
Standalone View
Standalone View
kcm/package/contents/ui/OutputPanel.qml
Show All 13 Lines | |||||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | *********************************************************************/ | 16 | *********************************************************************/ | ||
17 | import QtQuick 2.9 | 17 | import QtQuick 2.9 | ||
18 | import QtQuick.Layouts 1.1 | 18 | import QtQuick.Layouts 1.1 | ||
19 | import QtQuick.Controls 2.3 as Controls | 19 | import QtQuick.Controls 2.3 as Controls | ||
20 | import org.kde.kirigami 2.4 as Kirigami | 20 | import org.kde.kirigami 2.4 as Kirigami | ||
21 | 21 | | |||
22 | import org.kde.kcm 1.2 as KCM | ||||
23 | | ||||
22 | ColumnLayout { | 24 | ColumnLayout { | ||
23 | id: outputPanel | 25 | id: outputPanel | ||
24 | property var element: model | 26 | property var element: model | ||
25 | 27 | | |||
26 | Kirigami.FormLayout { | 28 | Kirigami.Heading { | ||
27 | Controls.Label { | 29 | Layout.fillWidth: true | ||
28 | // Kirigami.FormData.label: i18n("Name") | 30 | horizontalAlignment: Text.AlignHCenter | ||
29 | text: element.display | 31 | level: 2 | ||
32 | text: i18n("Settings for %1", element.display) | ||||
33 | visible: kcm.numberOfOutputs > 1 | ||||
GB_2: `element.count > 1` | |||||
element or model is not the whole model but only the current element of the model displayed by the view delegate. So it's a single element of the model without a count. What you need is to take the count on the overall model. As the OutputPanel is part of Panel you can use for example here panelView.count. This way an additional getter is not required. Also you could use OutputModel::rowCount as in: kcm.outputModel.rowCount() (it is already Q_INVOKABLE, see docs). romangg: `element` or `model` is not the whole model but only the current element of the model displayed… | |||||
30 | } | 34 | } | ||
31 | 35 | | |||
36 | Kirigami.FormLayout { | ||||
37 | | ||||
32 | Controls.CheckBox { | 38 | Controls.CheckBox { | ||
33 | text: i18n("Enabled") | 39 | text: i18n("Enabled") | ||
34 | checked: element.enabled | 40 | checked: element.enabled | ||
35 | onClicked: element.enabled = checked | 41 | onClicked: element.enabled = checked | ||
42 | visible: kcm.numberOfOutputs > 1 | ||||
GB_2: `element.count > 1` | |||||
36 | } | 43 | } | ||
37 | 44 | | |||
38 | Controls.CheckBox { | 45 | Controls.CheckBox { | ||
39 | text: i18n("Primary") | 46 | text: i18n("Primary") | ||
40 | checked: element.primary | 47 | checked: element.primary | ||
41 | onClicked: element.primary = checked | 48 | onClicked: element.primary = checked | ||
42 | visible: kcm.primaryOutputSupported | 49 | visible: kcm.primaryOutputSupported && kcm.numberOfOutputs > 1 | ||
GB_2: `element.count > 1` | |||||
43 | } | 50 | } | ||
44 | 51 | | |||
45 | Controls.ComboBox { | 52 | Controls.ComboBox { | ||
46 | Kirigami.FormData.label: i18n("Resolution:") | 53 | Kirigami.FormData.label: i18n("Resolution:") | ||
47 | model: element.resolutions | 54 | model: element.resolutions | ||
48 | currentIndex: element.resolutionIndex !== undefined ? | 55 | currentIndex: element.resolutionIndex !== undefined ? | ||
49 | element.resolutionIndex : -1 | 56 | element.resolutionIndex : -1 | ||
50 | onActivated: element.resolutionIndex = currentIndex | 57 | onActivated: element.resolutionIndex = currentIndex | ||
51 | } | 58 | } | ||
52 | 59 | | |||
53 | ColumnLayout { | 60 | ColumnLayout { | ||
54 | Layout.fillWidth: true | 61 | Layout.fillWidth: true | ||
55 | 62 | | |||
56 | visible: kcm.perOutputScaling | 63 | visible: kcm.perOutputScaling | ||
57 | Kirigami.FormData.label: i18n("Scale:") | 64 | Kirigami.FormData.label: i18n("Scale:") | ||
65 | Kirigami.FormData.buddyFor: scaleSlider | ||||
66 | | ||||
58 | Controls.Slider { | 67 | Controls.Slider { | ||
59 | id: scaleSlider | 68 | id: scaleSlider | ||
60 | 69 | | |||
61 | Layout.fillWidth: true | 70 | Layout.fillWidth: true | ||
62 | from: 0.5 | 71 | from: 0.5 | ||
63 | to: 3 | 72 | to: 3 | ||
64 | stepSize: 0.1 | 73 | stepSize: 0.1 | ||
65 | live: true | 74 | live: true | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |
element.count > 1