Experiments on toolbars
This commit is contained in:
parent
0e2e0a05eb
commit
3814f63ac0
11 changed files with 141 additions and 73 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -22,3 +22,4 @@ ui_*.h
|
||||||
/paysages3d-linux/
|
/paysages3d-linux/
|
||||||
/paysages3d-linux.tar.bz2
|
/paysages3d-linux.tar.bz2
|
||||||
/config.vim
|
/config.vim
|
||||||
|
/callgrind.out.*
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
<RCC>
|
|
||||||
<qresource prefix="/toolbar/primary">
|
|
||||||
<file>tab_water.png</file>
|
|
||||||
<file>tab_atmosphere.png</file>
|
|
||||||
<file>tab_clouds.png</file>
|
|
||||||
<file>tab_render.png</file>
|
|
||||||
<file>tab_terrain.png</file>
|
|
||||||
<file>tab_textures.png</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
21
src/interface/modeler/quickapp/qml/Toolbar.qml
Normal file
21
src/interface/modeler/quickapp/qml/Toolbar.qml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
|
||||||
|
default property alias children : inner_space.children
|
||||||
|
width: 70
|
||||||
|
height: parent.height
|
||||||
|
color: "#50000000"
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: inner_space
|
||||||
|
spacing: (parent.height - children.length * tool_terrain.height) / (children.length + 1)
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
PropertyAnimation {
|
||||||
|
duration: 200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,8 @@ Item {
|
||||||
property string picture
|
property string picture
|
||||||
property bool selected: false
|
property bool selected: false
|
||||||
property bool hovered: false
|
property bool hovered: false
|
||||||
|
property string helptext
|
||||||
|
property string hovertext
|
||||||
|
|
||||||
width: image.width + 10
|
width: image.width + 10
|
||||||
height: image.height + 10
|
height: image.height + 10
|
||||||
|
@ -26,14 +28,42 @@ Item {
|
||||||
id: image
|
id: image
|
||||||
source: parent.picture
|
source: parent.picture
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
width: 32
|
||||||
|
height: 32
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
onEntered: parent.hovered = true
|
onEntered: {
|
||||||
onExited: parent.hovered = false
|
parent.hovered = true;
|
||||||
onClicked: parent.selected = true
|
tooltip_widget.hovertext = hovertext;
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
parent.hovered = false;
|
||||||
|
tooltip_widget.hovertext = "";
|
||||||
|
}
|
||||||
|
onClicked: {
|
||||||
|
parent.selected = !parent.selected;
|
||||||
|
if (parent.selected)
|
||||||
|
{
|
||||||
|
var toolbar = parent.parent;
|
||||||
|
for (var i = 0; i < toolbar.children.length; ++i)
|
||||||
|
{
|
||||||
|
var child = toolbar.children[i]
|
||||||
|
if (child !== parent)
|
||||||
|
{
|
||||||
|
child.selected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tooltip_widget.helptext = helptext;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tooltip_widget.helptext = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
src/interface/modeler/quickapp/qml/Tooltip.qml
Normal file
16
src/interface/modeler/quickapp/qml/Tooltip.qml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
property string helptext
|
||||||
|
property string hovertext
|
||||||
|
width: content.width
|
||||||
|
height: content.height
|
||||||
|
|
||||||
|
color: "#99000000"
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: content
|
||||||
|
color: "white"
|
||||||
|
text: parent.helptext || parent.hovertext
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,5 +8,10 @@
|
||||||
<file>images/tab_terrain.png</file>
|
<file>images/tab_terrain.png</file>
|
||||||
<file>images/tab_textures.png</file>
|
<file>images/tab_textures.png</file>
|
||||||
<file>images/tab_water.png</file>
|
<file>images/tab_water.png</file>
|
||||||
|
<file>images/tab_display.png</file>
|
||||||
|
<file>Toolbar.qml</file>
|
||||||
|
<file>images/display_topdown.png</file>
|
||||||
|
<file>images/help.png</file>
|
||||||
|
<file>Tooltip.qml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/interface/modeler/quickapp/qml/images/display_topdown.png
Normal file
BIN
src/interface/modeler/quickapp/qml/images/display_topdown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.6 KiB |
BIN
src/interface/modeler/quickapp/qml/images/help.png
Normal file
BIN
src/interface/modeler/quickapp/qml/images/help.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
src/interface/modeler/quickapp/qml/images/tab_display.png
Normal file
BIN
src/interface/modeler/quickapp/qml/images/tab_display.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
|
@ -2,36 +2,30 @@ import QtQuick 2.2
|
||||||
import Paysages 1.0
|
import Paysages 1.0
|
||||||
|
|
||||||
OpenGLView {
|
OpenGLView {
|
||||||
|
id: main_ui
|
||||||
|
state: "Init"
|
||||||
|
|
||||||
width: 640
|
width: 800
|
||||||
height: 480
|
height: 600
|
||||||
|
|
||||||
Item {
|
Tooltip {
|
||||||
|
id: tooltip_widget
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
}
|
||||||
|
|
||||||
|
Toolbar {
|
||||||
id: primary_toolbar
|
id: primary_toolbar
|
||||||
x: 0
|
color: "#90000000"
|
||||||
y: 0
|
|
||||||
width: 70
|
|
||||||
height: parent.height
|
|
||||||
|
|
||||||
Rectangle {
|
anchors.left: parent.left
|
||||||
width: parent.height
|
|
||||||
height: parent.width
|
ToolbarButton {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
id: tool_display
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
picture: "images/tab_display.png"
|
||||||
transformOrigin: Item.Center
|
hovertext: qsTr("Display options")
|
||||||
rotation: -90
|
|
||||||
gradient: Gradient {
|
|
||||||
GradientStop { position: 0.0; color: "#605055FF" }
|
|
||||||
GradientStop { position: 1.0; color: "#005055FF" }
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: (parent.height - 6 * tool_terrain.height) / 7
|
|
||||||
|
|
||||||
ToolbarButton {
|
ToolbarButton {
|
||||||
id: tool_terrain
|
id: tool_terrain
|
||||||
picture: "images/tab_terrain.png"
|
picture: "images/tab_terrain.png"
|
||||||
|
@ -57,21 +51,30 @@ OpenGLView {
|
||||||
picture: "images/tab_render.png"
|
picture: "images/tab_render.png"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Toolbar {
|
||||||
id: toolbar_render
|
id: display_toolbar
|
||||||
anchors.top: primary_toolbar.top
|
opacity: 0
|
||||||
anchors.left: primary_toolbar.right
|
anchors.left: primary_toolbar.right
|
||||||
width: primary_toolbar.width
|
|
||||||
height: primary_toolbar.height
|
|
||||||
color: "#8800FF00"
|
|
||||||
|
|
||||||
SequentialAnimation on width {
|
ToolbarButton {
|
||||||
loops: Animation.Infinite
|
id: tool_display_topdown
|
||||||
PropertyAnimation { to: 0; duration: 1000 }
|
picture: "images/display_topdown.png"
|
||||||
PropertyAnimation { to: primary_toolbar.width; duration: 1000 }
|
hovertext: qsTr("Top-down view")
|
||||||
|
helptext: qsTr("Drag the mouse on the map to change the viewpoint.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "Display Mode"
|
||||||
|
when: tool_display.selected
|
||||||
|
|
||||||
|
PropertyChanges {
|
||||||
|
target: display_toolbar
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,4 +53,6 @@ DEPENDPATH += $$PWD/../../../render/opengl
|
||||||
OTHER_FILES += \
|
OTHER_FILES += \
|
||||||
qml/main.qml \
|
qml/main.qml \
|
||||||
qml/ToolbarButton.qml \
|
qml/ToolbarButton.qml \
|
||||||
qml/OpenGLView.qml
|
qml/OpenGLView.qml \
|
||||||
|
qml/Toolbar.qml \
|
||||||
|
qml/Tooltip.qml
|
||||||
|
|
Loading…
Reference in a new issue