Styling fixes in Toolbar QML

This commit is contained in:
Arjen Hiemstra 2017-04-25 11:31:59 +02:00
parent 33d92f9596
commit 09f23f5f91

View File

@ -8,26 +8,30 @@ import QtQuick.Layouts 1.1
import UM 1.0 as UM import UM 1.0 as UM
Item { Item
{
id: base; id: base;
width: buttons.width; width: buttons.width;
height: buttons.height height: buttons.height
property int activeY property int activeY
ColumnLayout { Column
{
id: buttons; id: buttons;
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
anchors.left: parent.left; anchors.left: parent.left;
spacing: UM.Theme.getSize("button_lining").width spacing: UM.Theme.getSize("button_lining").width
Repeater { Repeater
{
id: repeat id: repeat
model: UM.ToolModel { } model: UM.ToolModel { }
Button { Button
{
text: model.name text: model.name
iconSource: UM.Theme.getIcon(model.icon); iconSource: UM.Theme.getIcon(model.icon);
@ -45,9 +49,11 @@ Item {
} }
//Workaround since using ToolButton"s onClicked would break the binding of the checked property, instead //Workaround since using ToolButton"s onClicked would break the binding of the checked property, instead
//just catch the click so we do not trigger that behaviour. //just catch the click so we do not trigger that behaviour.
MouseArea { MouseArea
{
anchors.fill: parent; anchors.fill: parent;
onClicked: { onClicked:
{
forceActiveFocus() //First grab focus, so all the text fields are updated forceActiveFocus() //First grab focus, so all the text fields are updated
if(parent.checked) if(parent.checked)
{ {
@ -63,7 +69,8 @@ Item {
} }
} }
UM.PointingRectangle { UM.PointingRectangle
{
id: panelBorder; id: panelBorder;
anchors.left: parent.right; anchors.left: parent.right;
@ -75,7 +82,8 @@ Item {
target: Qt.point(parent.right, base.activeY + UM.Theme.getSize("button").height/2) target: Qt.point(parent.right, base.activeY + UM.Theme.getSize("button").height/2)
arrowSize: UM.Theme.getSize("default_arrow").width arrowSize: UM.Theme.getSize("default_arrow").width
width: { width:
{
if (panel.item && panel.width > 0){ if (panel.item && panel.width > 0){
return Math.max(panel.width + 2 * UM.Theme.getSize("default_margin").width) return Math.max(panel.width + 2 * UM.Theme.getSize("default_margin").width)
} }
@ -90,7 +98,8 @@ Item {
color: UM.Theme.getColor("lining"); color: UM.Theme.getColor("lining");
UM.PointingRectangle { UM.PointingRectangle
{
id: panelBackground; id: panelBackground;
color: UM.Theme.getColor("tool_panel_background"); color: UM.Theme.getColor("tool_panel_background");
@ -105,7 +114,8 @@ Item {
} }
} }
Loader { Loader
{
id: panel id: panel
x: UM.Theme.getSize("default_margin").width; x: UM.Theme.getSize("default_margin").width;
@ -116,6 +126,8 @@ Item {
} }
} }
// This rectangle displays the information about the current angle etc. when
// dragging a tool handle.
Rectangle Rectangle
{ {
x: -base.x + base.mouseX + UM.Theme.getSize("default_margin").width x: -base.x + base.mouseX + UM.Theme.getSize("default_margin").width