[ui] GraphEditor: improved ToolBar

* replace text buttons with MaterialToolButtons
* hide advanced min/max depth settings to a Settings menu
This commit is contained in:
Yann Lanthony 2018-07-27 18:28:49 +02:00
parent 9303fb7491
commit 94cba653d5
2 changed files with 56 additions and 18 deletions

View file

@ -1,6 +1,8 @@
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import Controls 1.0
import MaterialIcons 2.2
/** /**
A component displaying a Graph (nodes, attributes and edges). A component displaying a Graph (nodes, attributes and edges).
@ -345,28 +347,61 @@ Item {
} }
} }
Row { // Toolbar
FloatingPane {
padding: 2
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
RowLayout {
Button { spacing: 4
text: "Fit" // Fit
MaterialToolButton {
text: MaterialIcons.fullscreen
ToolTip.text: "Fit"
onClicked: root.fit() onClicked: root.fit()
z: 10 }
// Auto-Layout
MaterialToolButton {
text: MaterialIcons.linear_scale
ToolTip.text: "Auto-Layout"
onClicked: uigraph.layout.reset()
} }
Button { // Separator
text: "Layout" Rectangle {
onClicked: uigraph.layout.reset() Layout.fillHeight: true
z: 10 Layout.margins: 2
implicitWidth: 1
color: activePalette.window
}
// Settings
MaterialToolButton {
text: MaterialIcons.settings
font.pointSize: 11
onClicked: menu.open()
Menu {
id: menu
y: -height
padding: 4
RowLayout {
spacing: 2
Label {
padding: 2
text: "Auto-Layout Depth:"
} }
ComboBox { ComboBox {
model: ['Min Depth', 'Max Depth'] flat: true
model: ['Minimum', 'Maximum']
implicitWidth: 80
currentIndex: uigraph.layout.depthMode currentIndex: uigraph.layout.depthMode
onActivated: { onActivated: {
uigraph.layout.depthMode = currentIndex uigraph.layout.depthMode = currentIndex
} }
} }
} }
}
}
}
}
function registerAttributePin(attribute, pin) function registerAttributePin(attribute, pin)
{ {

View file

@ -440,13 +440,16 @@ ApplicationWindow {
Item { Item {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
Layout.margins: 10 Layout.margins: 2
GraphEditor { GraphEditor {
id: graphEditor id: graphEditor
anchors.fill: parent anchors.fill: parent
uigraph: _reconstruction uigraph: _reconstruction
nodeTypesModel: _nodeTypes nodeTypesModel: _nodeTypes
readOnly: _reconstruction.computing readOnly: _reconstruction.computing
onNodeDoubleClicked: { onNodeDoubleClicked: {
if(node.nodeType == "StructureFromMotion") if(node.nodeType == "StructureFromMotion")
{ {