Loading editor/qml/SurveyEditorDialog.qml +77 −3 Changes for editor/qml/SurveyEditorDialog.qml: 77 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -517,7 +517,9 @@ Window { /* ===== Graphical Options Editor ===== */ ColumnLayout { Layout.fillWidth: true; spacing: 4 visible: qTypeCombo.currentText !== "text" && qTypeCombo.currentText !== "rating" && qTypeCombo.currentText !== "image" visible: qTypeCombo.currentText !== "text" && qTypeCombo.currentText !== "rating" property bool isMediaType: qTypeCombo.currentText === "image" || qTypeCombo.currentText === "icon" RowLayout { Layout.fillWidth: true Loading @@ -535,15 +537,19 @@ Window { ListView { id: optionsListView Layout.fillWidth: true Layout.preferredHeight: Math.min(optionsModel.count * 36, 120) Layout.preferredHeight: Math.min(optionsModel.count * (isMediaType ? 52 : 36), isMediaType ? 200 : 120) clip: true model: ListModel { id: optionsModel } property bool isMediaType: qTypeCombo.currentText === "image" || qTypeCombo.currentText === "icon" delegate: RowLayout { width: optionsListView.width height: 34; spacing: 4 height: optionsListView.isMediaType ? 50 : 34; spacing: 4 /* Radio/Checkbox indicator (non-media types) */ Rectangle { visible: !optionsListView.isMediaType width: 20; height: 20 radius: qTypeCombo.currentText === "radio" ? 10 : 3 border.color: editorWin.typeColors[qTypeCombo.currentText] || "#888" Loading @@ -556,6 +562,34 @@ Window { } } /* Image/Icon thumbnail (media types) */ Rectangle { visible: optionsListView.isMediaType width: 44; height: 44; radius: 4 color: Theme.bgTertiary; border.color: Theme.border; border.width: 1 Image { anchors.fill: parent; anchors.margins: 2 source: model.optIcon ? "image://auth/" + model.optIcon + "?w=40&h=40" : "" fillMode: Image.PreserveAspectFit asynchronous: true visible: model.optIcon !== "" } Label { anchors.centerIn: parent text: qTypeCombo.currentText === "image" ? "\u25A3" : "\u25C6" font.pixelSize: 18; color: Theme.textMuted visible: model.optIcon === "" } MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: openMediaBrowser(index) } } TextField { Layout.preferredWidth: 100 text: model.optValue; placeholderText: "value" Loading @@ -572,6 +606,14 @@ Window { onTextChanged: { optionsModel.set(index, { optValue: model.optValue, optLabel: text, optExcludes: model.optExcludes, optIcon: model.optIcon }); saveOptionsToQuestion() } } /* Browse button for media types */ Button { visible: optionsListView.isMediaType text: "\u2026"; font.pixelSize: 12; implicitWidth: 28; implicitHeight: 26 ToolTip.visible: hovered; ToolTip.text: qsTr("Browse media") onClicked: openMediaBrowser(index) } TextField { Layout.preferredWidth: 80 text: model.optExcludes; placeholderText: "excludes" Loading Loading @@ -691,4 +733,36 @@ Window { function clearQuestionEditor() { editingIndex = -1; qTextField.text = ""; qRequiredCheck.checked = false; optionsModel.clear() } /* ===== Media Browser for image/icon options ===== */ property int mediaBrowseOptionIndex: -1 function openMediaBrowser(optIdx) { mediaBrowseOptionIndex = optIdx mediaBrowserLoader.active = true } Loader { id: mediaBrowserLoader active: false sourceComponent: MediaBrowser { id: mediaBrowserDlg onMediaSelected: function(url) { if (editorWin.mediaBrowseOptionIndex >= 0 && editorWin.mediaBrowseOptionIndex < optionsModel.count) { var o = optionsModel.get(editorWin.mediaBrowseOptionIndex) optionsModel.set(editorWin.mediaBrowseOptionIndex, { optValue: o.optValue, optLabel: o.optLabel, optExcludes: o.optExcludes, optIcon: url }) saveOptionsToQuestion() } } onClosed: { mediaBrowserLoader.active = false } Component.onCompleted: open() } } } No newline at end of file Loading
editor/qml/SurveyEditorDialog.qml +77 −3 Changes for editor/qml/SurveyEditorDialog.qml: 77 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -517,7 +517,9 @@ Window { /* ===== Graphical Options Editor ===== */ ColumnLayout { Layout.fillWidth: true; spacing: 4 visible: qTypeCombo.currentText !== "text" && qTypeCombo.currentText !== "rating" && qTypeCombo.currentText !== "image" visible: qTypeCombo.currentText !== "text" && qTypeCombo.currentText !== "rating" property bool isMediaType: qTypeCombo.currentText === "image" || qTypeCombo.currentText === "icon" RowLayout { Layout.fillWidth: true Loading @@ -535,15 +537,19 @@ Window { ListView { id: optionsListView Layout.fillWidth: true Layout.preferredHeight: Math.min(optionsModel.count * 36, 120) Layout.preferredHeight: Math.min(optionsModel.count * (isMediaType ? 52 : 36), isMediaType ? 200 : 120) clip: true model: ListModel { id: optionsModel } property bool isMediaType: qTypeCombo.currentText === "image" || qTypeCombo.currentText === "icon" delegate: RowLayout { width: optionsListView.width height: 34; spacing: 4 height: optionsListView.isMediaType ? 50 : 34; spacing: 4 /* Radio/Checkbox indicator (non-media types) */ Rectangle { visible: !optionsListView.isMediaType width: 20; height: 20 radius: qTypeCombo.currentText === "radio" ? 10 : 3 border.color: editorWin.typeColors[qTypeCombo.currentText] || "#888" Loading @@ -556,6 +562,34 @@ Window { } } /* Image/Icon thumbnail (media types) */ Rectangle { visible: optionsListView.isMediaType width: 44; height: 44; radius: 4 color: Theme.bgTertiary; border.color: Theme.border; border.width: 1 Image { anchors.fill: parent; anchors.margins: 2 source: model.optIcon ? "image://auth/" + model.optIcon + "?w=40&h=40" : "" fillMode: Image.PreserveAspectFit asynchronous: true visible: model.optIcon !== "" } Label { anchors.centerIn: parent text: qTypeCombo.currentText === "image" ? "\u25A3" : "\u25C6" font.pixelSize: 18; color: Theme.textMuted visible: model.optIcon === "" } MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: openMediaBrowser(index) } } TextField { Layout.preferredWidth: 100 text: model.optValue; placeholderText: "value" Loading @@ -572,6 +606,14 @@ Window { onTextChanged: { optionsModel.set(index, { optValue: model.optValue, optLabel: text, optExcludes: model.optExcludes, optIcon: model.optIcon }); saveOptionsToQuestion() } } /* Browse button for media types */ Button { visible: optionsListView.isMediaType text: "\u2026"; font.pixelSize: 12; implicitWidth: 28; implicitHeight: 26 ToolTip.visible: hovered; ToolTip.text: qsTr("Browse media") onClicked: openMediaBrowser(index) } TextField { Layout.preferredWidth: 80 text: model.optExcludes; placeholderText: "excludes" Loading Loading @@ -691,4 +733,36 @@ Window { function clearQuestionEditor() { editingIndex = -1; qTextField.text = ""; qRequiredCheck.checked = false; optionsModel.clear() } /* ===== Media Browser for image/icon options ===== */ property int mediaBrowseOptionIndex: -1 function openMediaBrowser(optIdx) { mediaBrowseOptionIndex = optIdx mediaBrowserLoader.active = true } Loader { id: mediaBrowserLoader active: false sourceComponent: MediaBrowser { id: mediaBrowserDlg onMediaSelected: function(url) { if (editorWin.mediaBrowseOptionIndex >= 0 && editorWin.mediaBrowseOptionIndex < optionsModel.count) { var o = optionsModel.get(editorWin.mediaBrowseOptionIndex) optionsModel.set(editorWin.mediaBrowseOptionIndex, { optValue: o.optValue, optLabel: o.optLabel, optExcludes: o.optExcludes, optIcon: url }) saveOptionsToQuestion() } } onClosed: { mediaBrowserLoader.active = false } Component.onCompleted: open() } } } No newline at end of file