[ui] add "Controls" module to centralize common UI components

* add FloatingPane control + use it in Viewer3D
This commit is contained in:
Yann Lanthony 2018-03-20 02:26:06 +01:00
parent 6ae591e981
commit d4c0a4975a
3 changed files with 30 additions and 8 deletions

View file

@ -0,0 +1,17 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
/**
* FloatingPane provides a Pane with a slightly transparent default background
* using palette.base as color. Useful to create floating toolbar/overlays.
*/
Pane {
id: root
property bool opaque: false
padding: 6
anchors.margins: 2
background: Rectangle { color: root.palette.base; opacity: opaque ? 1.0 : 0.7; radius: 1 }
}

View file

@ -0,0 +1,3 @@
module Controls
FloatingPane 1.0 FloatingPane.qml

View file

@ -5,8 +5,11 @@ import QtQuick.Scene3D 2.0
import Qt3D.Core 2.1 import Qt3D.Core 2.1
import Qt3D.Render 2.1 import Qt3D.Render 2.1
import Qt3D.Input 2.1 as Qt3DInput // to avoid clash with Controls2 Action import Qt3D.Input 2.1 as Qt3DInput // to avoid clash with Controls2 Action
import MaterialIcons 2.2 import MaterialIcons 2.2
import Controls 1.0
FocusScope { FocusScope {
id: root id: root
@ -349,8 +352,8 @@ FocusScope {
// //
// Rotation/Scale // Rotation/Scale
Pane { FloatingPane {
background: Rectangle { color: palette.base; opacity: 0.5; radius: 2 } anchors { top: parent.top; left: parent.left }
GridLayout { GridLayout {
id: controlsLayout id: controlsLayout
@ -391,9 +394,8 @@ FocusScope {
} }
// Outliner // Outliner
Pane { FloatingPane {
anchors.right: parent.right anchors { top: parent.top; right: parent.right }
background: Rectangle { color: palette.base; opacity: 0.5; radius: 2 }
Column { Column {
Row { Row {
@ -430,9 +432,9 @@ FocusScope {
} }
// Render Mode // Render Mode
Pane { FloatingPane {
anchors.bottom: parent.bottom anchors { bottom: parent.bottom; left: parent.left }
background: Rectangle { color: palette.base; opacity: 0.5; radius: 2 }
Row { Row {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter