WIP on quick ui prototype

This commit is contained in:
Michaël Lemaire 2014-08-19 17:37:24 +02:00
parent f7d84afb79
commit 0d659d2e44
4 changed files with 54 additions and 19 deletions

View file

@ -16,6 +16,7 @@ OpenGLView::OpenGLView(QQuickItem *parent) :
connect(this, SIGNAL(windowChanged(QQuickWindow*)), this, SLOT(handleWindowChanged(QQuickWindow*))); connect(this, SIGNAL(windowChanged(QQuickWindow*)), this, SLOT(handleWindowChanged(QQuickWindow*)));
scenery.autoPreset(); scenery.autoPreset();
renderer.setScenery(&scenery); renderer.setScenery(&scenery);
} }

View file

@ -0,0 +1,39 @@
import QtQuick 2.0
Item {
property string code
property bool selected: false
property bool hovered: false
width: image.width + 10
height: image.height + 10
Rectangle {
id: glow
anchors.fill: parent
color: "white"
radius: 8
opacity: parent.selected ? 1.0 : (parent.hovered ? 0.5 : 0.0)
Behavior on opacity {
PropertyAnimation {
duration: 200
}
}
}
Image {
id: image
source: "qrc:///toolbar/primary/tab_" + parent.code + ".png"
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: parent.hovered = true
onExited: parent.hovered = false
onClicked: parent.selected = true
}
}

View file

@ -32,35 +32,29 @@ OpenGLView {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: (parent.height - 6 * tool_terrain.height) / 7 spacing: (parent.height - 6 * tool_terrain.height) / 7
Image { ToolbarButton {
id: tool_terrain id: tool_terrain
opacity: 0.5 code: "terrain"
source: "qrc:///toolbar/primary/tab_terrain.png"
} }
Image { ToolbarButton {
id: tool_textures id: tool_textures
opacity: 0.5 code: "textures"
source: "qrc:///toolbar/primary/tab_textures.png"
} }
Image { ToolbarButton {
id: tool_water id: tool_water
opacity: 0.5 code: "water"
source: "qrc:///toolbar/primary/tab_water.png"
} }
Image { ToolbarButton {
id: tool_atmosphere id: tool_atmosphere
opacity: 0.5 code: "atmosphere"
source: "qrc:///toolbar/primary/tab_atmosphere.png"
} }
Image { ToolbarButton {
id: tool_clouds id: tool_clouds
opacity: 0.5 code: "clouds"
source: "qrc:///toolbar/primary/tab_clouds.png"
} }
Image { ToolbarButton {
id: tool_render id: tool_render
opacity: 0.5 code: "render"
source: "qrc:///toolbar/primary/tab_render.png"
} }
} }
} }
@ -71,7 +65,7 @@ OpenGLView {
anchors.left: primary_toolbar.right anchors.left: primary_toolbar.right
width: primary_toolbar.width width: primary_toolbar.width
height: primary_toolbar.height height: primary_toolbar.height
color: "green" color: "#8800FF00"
SequentialAnimation on width { SequentialAnimation on width {
loops: Animation.Infinite loops: Animation.Infinite

View file

@ -1,5 +1,6 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>main.qml</file> <file>main.qml</file>
<file>ToolbarButton.qml</file>
</qresource> </qresource>
</RCC> </RCC>