mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-02 17:37:19 +02:00
[ui] Attribute: display icon on advanced parameters
This commit is contained in:
parent
1c935b6b5a
commit
dc8be1efae
1 changed files with 76 additions and 57 deletions
|
@ -20,81 +20,100 @@ RowLayout {
|
||||||
|
|
||||||
signal doubleClicked(var attr)
|
signal doubleClicked(var attr)
|
||||||
|
|
||||||
spacing: 4
|
spacing: 2
|
||||||
|
|
||||||
Label {
|
|
||||||
id: parameterLabel
|
|
||||||
|
|
||||||
|
Pane {
|
||||||
|
background: Rectangle { color: Qt.darker(parent.palette.window, 1.1) }
|
||||||
|
padding: 0
|
||||||
Layout.preferredWidth: labelWidth || implicitWidth
|
Layout.preferredWidth: labelWidth || implicitWidth
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
horizontalAlignment: attribute.isOutput ? Qt.AlignRight : Qt.AlignLeft
|
|
||||||
elide: Label.ElideRight
|
|
||||||
padding: 5
|
|
||||||
wrapMode: Label.WrapAtWordBoundaryOrAnywhere
|
|
||||||
|
|
||||||
text: attribute.label
|
RowLayout {
|
||||||
|
spacing: 0
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
Label {
|
||||||
|
id: parameterLabel
|
||||||
|
|
||||||
// Tooltip hint with attribute's description
|
Layout.fillHeight: true
|
||||||
ToolTip.text: object.desc.description
|
Layout.fillWidth: true
|
||||||
ToolTip.visible: parameterMA.containsMouse && object.desc.description
|
horizontalAlignment: attribute.isOutput ? Qt.AlignRight : Qt.AlignLeft
|
||||||
ToolTip.delay: 800
|
elide: Label.ElideRight
|
||||||
|
padding: 5
|
||||||
|
wrapMode: Label.WrapAtWordBoundaryOrAnywhere
|
||||||
|
|
||||||
// make label bold if attribute's value is not the default one
|
text: attribute.label
|
||||||
font.bold: !object.isOutput && !object.isDefault
|
|
||||||
|
|
||||||
// make label italic if attribute is a link
|
// Tooltip hint with attribute's description
|
||||||
font.italic: object.isLink
|
ToolTip.text: object.desc.description
|
||||||
|
ToolTip.visible: parameterMA.containsMouse && object.desc.description
|
||||||
|
ToolTip.delay: 800
|
||||||
|
|
||||||
background: Rectangle { color: Qt.darker(parent.palette.window, 1.2) }
|
// make label bold if attribute's value is not the default one
|
||||||
|
font.bold: !object.isOutput && !object.isDefault
|
||||||
|
|
||||||
MouseArea {
|
// make label italic if attribute is a link
|
||||||
id: parameterMA
|
font.italic: object.isLink
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
acceptedButtons: Qt.AllButtons
|
|
||||||
onDoubleClicked: root.doubleClicked(root.attribute)
|
|
||||||
|
|
||||||
property Component menuComp: Menu {
|
|
||||||
id: paramMenu
|
|
||||||
|
|
||||||
property bool isFileAttribute: attribute.type == "File"
|
MouseArea {
|
||||||
property bool isFilepath: isFileAttribute && Filepath.isFile(attribute.value)
|
id: parameterMA
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
acceptedButtons: Qt.AllButtons
|
||||||
|
onDoubleClicked: root.doubleClicked(root.attribute)
|
||||||
|
|
||||||
MenuItem {
|
property Component menuComp: Menu {
|
||||||
text: "Reset To Default Value"
|
id: paramMenu
|
||||||
enabled: root.editable && !attribute.isDefault
|
|
||||||
onTriggered: _reconstruction.resetAttribute(attribute)
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuSeparator {
|
property bool isFileAttribute: attribute.type == "File"
|
||||||
visible: paramMenu.isFileAttribute
|
property bool isFilepath: isFileAttribute && Filepath.isFile(attribute.value)
|
||||||
height: visible ? implicitHeight : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
visible: paramMenu.isFileAttribute
|
text: "Reset To Default Value"
|
||||||
height: visible ? implicitHeight : 0
|
enabled: root.editable && !attribute.isDefault
|
||||||
text: paramMenu.isFilepath ? "Open Containing Folder" : "Open Folder"
|
onTriggered: _reconstruction.resetAttribute(attribute)
|
||||||
onClicked: paramMenu.isFilepath ? Qt.openUrlExternally(Filepath.dirname(attribute.value)) :
|
}
|
||||||
Qt.openUrlExternally(Filepath.stringToUrl(attribute.value))
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuItem {
|
MenuSeparator {
|
||||||
visible: paramMenu.isFilepath
|
visible: paramMenu.isFileAttribute
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
text: "Open File"
|
}
|
||||||
onClicked: Qt.openUrlExternally(Filepath.stringToUrl(attribute.value))
|
|
||||||
|
MenuItem {
|
||||||
|
visible: paramMenu.isFileAttribute
|
||||||
|
height: visible ? implicitHeight : 0
|
||||||
|
text: paramMenu.isFilepath ? "Open Containing Folder" : "Open Folder"
|
||||||
|
onClicked: paramMenu.isFilepath ? Qt.openUrlExternally(Filepath.dirname(attribute.value)) :
|
||||||
|
Qt.openUrlExternally(Filepath.stringToUrl(attribute.value))
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem {
|
||||||
|
visible: paramMenu.isFilepath
|
||||||
|
height: visible ? implicitHeight : 0
|
||||||
|
text: "Open File"
|
||||||
|
onClicked: Qt.openUrlExternally(Filepath.stringToUrl(attribute.value))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
forceActiveFocus()
|
||||||
|
if(mouse.button == Qt.RightButton)
|
||||||
|
{
|
||||||
|
var menu = menuComp.createObject(parameterLabel)
|
||||||
|
menu.parent = parameterLabel
|
||||||
|
menu.popup()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MaterialLabel {
|
||||||
onClicked: {
|
visible: attribute.desc.advanced
|
||||||
forceActiveFocus()
|
text: MaterialIcons.build
|
||||||
if(mouse.button == Qt.RightButton)
|
color: palette.mid
|
||||||
{
|
font.pointSize: 8
|
||||||
var menu = menuComp.createObject(parameterLabel)
|
padding: 4
|
||||||
menu.parent = parameterLabel
|
|
||||||
menu.popup()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue