Adding picker for properties (x,y,labelX)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5cef8e23fa
commit
6abbbe5e61
4 changed files with 84 additions and 33 deletions
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
import Qt.labs.platform as Native
|
||||||
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
|
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
|
||||||
import "../../js/objects.js" as Objects
|
import "../../js/objects.js" as Objects
|
||||||
import "../../js/historylib.js" as HistoryLib
|
import "../../js/historylib.js" as HistoryLib
|
||||||
|
@ -43,6 +44,11 @@ Repeater {
|
||||||
Object whose properties to list and edit.
|
Object whose properties to list and edit.
|
||||||
*/
|
*/
|
||||||
property var obj
|
property var obj
|
||||||
|
/*!
|
||||||
|
\qmlproperty var CustomPropertyList::positionPicker
|
||||||
|
Reference to the global PositionPicker QML object.
|
||||||
|
*/
|
||||||
|
property var positionPicker
|
||||||
|
|
||||||
readonly property var textTypes: ['Domain', 'string', 'number']
|
readonly property var textTypes: ['Domain', 'string', 'number']
|
||||||
readonly property var comboBoxTypes: ['ObjectType', 'Enum']
|
readonly property var comboBoxTypes: ['ObjectType', 'Enum']
|
||||||
|
@ -123,15 +129,15 @@ Repeater {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// D.MessageDialog {
|
Native.MessageDialog {
|
||||||
// id: parsingErrorDialog
|
id: parsingErrorDialog
|
||||||
// title: qsTranslate("expression", "LogarithmPlotter - Parsing error")
|
title: qsTranslate("expression", "LogarithmPlotter - Parsing error")
|
||||||
// text: ""
|
text: ""
|
||||||
// function showDialog(propName, propValue, error) {
|
function showDialog(propName, propValue, error) {
|
||||||
// text = qsTranslate("error", "Error while parsing expression for property %1:\n%2\n\nEvaluated expression: %3").arg(propName).arg(error).arg(propValue)
|
text = qsTranslate("error", "Error while parsing expression for property %1:\n%2\n\nEvaluated expression: %3").arg(propName).arg(error).arg(propValue)
|
||||||
// open()
|
open()
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,9 +261,13 @@ Repeater {
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: Component {
|
delegate: Component {
|
||||||
Loader {
|
Row {
|
||||||
//height: customPropComment.height + customPropText.height + customPropCheckBox.height + customPropCombo.height + customPropListDict.height
|
|
||||||
width: dlgProperties.width
|
width: dlgProperties.width
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: propertyEditor
|
||||||
|
width: dlgProperties.width - pointerButton.width
|
||||||
property string propertyName: modelData[0]
|
property string propertyName: modelData[0]
|
||||||
property var propertyType: modelData[1]
|
property var propertyType: modelData[1]
|
||||||
property string propertyLabel: qsTranslate('prop',propertyName)
|
property string propertyLabel: qsTranslate('prop',propertyName)
|
||||||
|
@ -280,5 +290,40 @@ Repeater {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: pointerButton
|
||||||
|
height: parent.height
|
||||||
|
width: visible ? height : 0
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
property bool isXProp: ['labelX', 'x'].includes(propertyEditor.propertyName)
|
||||||
|
property bool isYProp: ['y'].includes(propertyEditor.propertyName)
|
||||||
|
visible: isXProp || isYProp
|
||||||
|
ToolTip.visible: hovered
|
||||||
|
ToolTip.text: qsTr("Pick on graph")
|
||||||
|
|
||||||
|
Setting.Icon {
|
||||||
|
id: icon
|
||||||
|
width: 18
|
||||||
|
height: 18
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
color: sysPalette.windowText
|
||||||
|
source: '../icons/common/position.svg'
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
positionPicker.objType = objType
|
||||||
|
positionPicker.objName = obj.name
|
||||||
|
positionPicker.pickX = isXProp
|
||||||
|
positionPicker.pickY = isYProp
|
||||||
|
positionPicker.propertyX = propertyEditor.propertyName
|
||||||
|
positionPicker.propertyY = propertyEditor.propertyName
|
||||||
|
positionPicker.visible = true
|
||||||
|
objEditor.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,11 @@ Popup.BaseDialog {
|
||||||
Instance of the object being edited.
|
Instance of the object being edited.
|
||||||
*/
|
*/
|
||||||
property var obj: Objects.currentObjects[objType][objIndex]
|
property var obj: Objects.currentObjects[objType][objIndex]
|
||||||
|
/*!
|
||||||
|
\qmlproperty var EditorDialog::posPicker
|
||||||
|
Reference to the global PositionPicker QML object.
|
||||||
|
*/
|
||||||
|
property var posPicker
|
||||||
|
|
||||||
title: "LogarithmPlotter"
|
title: "LogarithmPlotter"
|
||||||
width: 350
|
width: 350
|
||||||
|
@ -106,7 +111,6 @@ Popup.BaseDialog {
|
||||||
value: objEditor.obj.name
|
value: objEditor.obj.name
|
||||||
onChanged: function(newValue) {
|
onChanged: function(newValue) {
|
||||||
let newName = Utils.parseName(newValue)
|
let newName = Utils.parseName(newValue)
|
||||||
console.log(newValue, newName)
|
|
||||||
if(newName != '' && objEditor.obj.name != newName) {
|
if(newName != '' && objEditor.obj.name != newName) {
|
||||||
if(newName in Objects.currentObjectsByName) {
|
if(newName in Objects.currentObjectsByName) {
|
||||||
invalidNameDialog.showDialog(newName)
|
invalidNameDialog.showDialog(newName)
|
||||||
|
@ -144,6 +148,7 @@ Popup.BaseDialog {
|
||||||
CustomPropertyList {
|
CustomPropertyList {
|
||||||
id: dlgCustomProperties
|
id: dlgCustomProperties
|
||||||
obj: objEditor.obj
|
obj: objEditor.obj
|
||||||
|
positionPicker: posPicker
|
||||||
|
|
||||||
onChanged: {
|
onChanged: {
|
||||||
obj.update()
|
obj.update()
|
||||||
|
|
|
@ -116,6 +116,8 @@ ScrollView {
|
||||||
// Object editor
|
// Object editor
|
||||||
Editor.Dialog {
|
Editor.Dialog {
|
||||||
id: objEditor
|
id: objEditor
|
||||||
|
|
||||||
|
posPicker: positionPicker
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -125,7 +125,6 @@ Item {
|
||||||
if(control.isInt) value = Math.max(control.min,parseInt(value).toString()=="NaN"?control.min:parseInt(value))
|
if(control.isInt) value = Math.max(control.min,parseInt(value).toString()=="NaN"?control.min:parseInt(value))
|
||||||
if(control.isDouble) value = Math.max(control.min,parseFloat(value).toString()=="NaN"?control.min:parseFloat(value))
|
if(control.isDouble) value = Math.max(control.min,parseFloat(value).toString()=="NaN"?control.min:parseFloat(value))
|
||||||
if(value != "" && value.toString() != defValue) {
|
if(value != "" && value.toString() != defValue) {
|
||||||
console.log(value, value.toString())
|
|
||||||
control.changed(value)
|
control.changed(value)
|
||||||
defValue = value.toString()
|
defValue = value.toString()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue