Rearrange Toolbar

Start unifying button tooltips
This commit is contained in:
fieldOfView 2015-11-26 17:15:01 +01:00
parent 47c53860fd
commit 1d27822970
4 changed files with 30 additions and 58 deletions

View File

@ -387,6 +387,7 @@ UM.MainWindow
source: UM.Theme.images.logo; source: UM.Theme.images.logo;
width: UM.Theme.sizes.logo.width; width: UM.Theme.sizes.logo.width;
height: UM.Theme.sizes.logo.height; height: UM.Theme.sizes.logo.height;
z: -1;
sourceSize.width: width; sourceSize.width: width;
sourceSize.height: height; sourceSize.height: height;
@ -395,11 +396,10 @@ UM.MainWindow
Button Button
{ {
id: viewModeButton id: viewModeButton
property bool verticalTooltip: true
anchors anchors
{ {
top: openFileButton.bottom; top: toolbar.bottom;
topMargin: UM.Theme.sizes.window_margin.height; topMargin: UM.Theme.sizes.window_margin.height;
left: parent.left; left: parent.left;
} }
@ -441,12 +441,9 @@ UM.MainWindow
id: toolbar; id: toolbar;
anchors { anchors {
left: openFileButton.right top: openFileButton.bottom;
leftMargin: UM.Theme.sizes.window_margin.width topMargin: UM.Theme.sizes.window_margin.height;
top: parent.top left: parent.left;
//horizontalCenter: parent.horizontalCenter
//horizontalCenterOffset: -(UM.Theme.sizes.sidebar.width / 2)
//top: parent.top;
} }
} }

View File

@ -15,7 +15,7 @@ Item {
height: buttons.height height: buttons.height
property int activeY property int activeY
RowLayout { ColumnLayout {
id: buttons; id: buttons;
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
@ -35,7 +35,6 @@ Item {
checked: model.active; checked: model.active;
enabled: UM.Selection.hasSelection; enabled: UM.Selection.hasSelection;
property bool verticalTooltip: true;
style: UM.Theme.styles.tool_button; style: UM.Theme.styles.tool_button;
//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
@ -64,9 +63,9 @@ Item {
Rectangle { Rectangle {
id: panelBackground; id: panelBackground;
anchors.left: parent.left; anchors.left: parent.right;
anchors.top: parent.bottom; anchors.leftMargin: UM.Theme.sizes.default_margin.width;
anchors.topMargin: UM.Theme.sizes.default_margin.width; anchors.top: parent.top;
y: base.activeY y: base.activeY
width: { width: {

View File

@ -28,7 +28,6 @@ QtObject {
} }
Label { Label {
id: sidebarComboBoxLabel id: sidebarComboBoxLabel
//property bool down: control.pressed || (control.checkable && control.checked);
color: UM.Theme.colors.setting_control_text color: UM.Theme.colors.setting_control_text
text: control.text; text: control.text;
elide: Text.ElideRight; elide: Text.ElideRight;
@ -38,18 +37,6 @@ QtObject {
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter;
font: UM.Theme.fonts.default font: UM.Theme.fonts.default
} }
/*
Rectangle{
id: separationLine
width: 1
height: UM.Theme.sizes.setting_control.height
color: UM.Theme.colors.setting_control_border
anchors.right: downArrow.left
anchors.rightMargin: UM.Theme.sizes.setting_unit_margin.width + downArrow.width/2
anchors.top: parent.top
z: parent.z + 1
}
*/
} }
label: Label{} label: Label{}
} }
@ -62,18 +49,21 @@ QtObject {
implicitHeight: UM.Theme.sizes.button.height; implicitHeight: UM.Theme.sizes.button.height;
Rectangle { Rectangle {
id: tool_button_background id: tool_button_background
anchors.top: parent.bottom; anchors.left: parent.right
anchors.verticalCenter: parent.verticalCenter
opacity: control.hovered ? 1.0 : 0.0;
width: parent.width; width: control.hovered ? label.width : 0;
height: control.hovered ? label.height : 0; height: label.height
Behavior on width { NumberAnimation { duration: 100; } }
Behavior on height { NumberAnimation { duration: 100; } } Behavior on height { NumberAnimation { duration: 100; } }
Behavior on opacity { NumberAnimation { duration: 100; } }
Label { Label {
id: label id: label
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
text: control.text text: control.text
width: UM.Theme.sizes.button.width;
wrapMode: Text.WordWrap
font: UM.Theme.fonts.button_tooltip; font: UM.Theme.fonts.button_tooltip;
color: UM.Theme.colors.button_tooltip_text; color: UM.Theme.colors.button_tooltip_text;
} }
@ -105,26 +95,12 @@ QtObject {
Rectangle { Rectangle {
id: tool_button_background id: tool_button_background
anchors.left: control.verticalTooltip ? parent.left : parent.right anchors.left: parent.right
anchors.verticalCenter: control.verticalTooltip ? undefined : parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.top: control.verticalTooltip ? parent.bottom : undefined
opacity: control.hovered ? 1.0 : 0.0; opacity: control.hovered ? 1.0 : 0.0;
width: { width: control.hovered ? label.width : 0;
if (control.verticalTooltip == true){ height: label.height
if (label.width > parent.width)
return label.width
else
return parent.width
}
else {
if (control.hovered)
return label.width
else
return 0
}
}
height: !control.verticalTooltip ? label.height : control.hovered ? label.height: 0
Behavior on width { NumberAnimation { duration: 100; } } Behavior on width { NumberAnimation { duration: 100; } }
Behavior on height { NumberAnimation { duration: 100; } } Behavior on height { NumberAnimation { duration: 100; } }
@ -198,21 +174,21 @@ QtObject {
Rectangle { Rectangle {
id: tool_button_background id: tool_button_background
anchors.top: parent.verticalCenter; anchors.left: parent.right
anchors.verticalCenter: parent.verticalCenter
width: parent.width;
height: control.hovered ? parent.height / 2 + label.height : 0;
Behavior on height { NumberAnimation { duration: 100; } }
opacity: control.hovered ? 1.0 : 0.0; opacity: control.hovered ? 1.0 : 0.0;
width: control.hovered ? label.width : 0;
height: label.height
Behavior on width { NumberAnimation { duration: 100; } }
Behavior on height { NumberAnimation { duration: 100; } }
Behavior on opacity { NumberAnimation { duration: 100; } } Behavior on opacity { NumberAnimation { duration: 100; } }
Label { Label {
id: label id: label
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
text: control.text text: control.text
width: UM.Theme.sizes.button.width;
wrapMode: Text.WordWrap
font: UM.Theme.fonts.button_tooltip; font: UM.Theme.fonts.button_tooltip;
color: UM.Theme.colors.button_tooltip_text; color: UM.Theme.colors.button_tooltip_text;
} }

View File

@ -203,7 +203,7 @@
"slider_groove": [0.5, 0.5], "slider_groove": [0.5, 0.5],
"slider_handle": [1.5, 1.5], "slider_handle": [1.5, 1.5],
"slider_layerview_size": [1.0, 20.0], "slider_layerview_size": [1.0, 16.0],
"slider_layerview_background": [4.0, 0.0], "slider_layerview_background": [4.0, 0.0],
"slider_layerview_smalltext_margin": [0.3, 0.00], "slider_layerview_smalltext_margin": [0.3, 0.00],
"slider_layerview_margin": [3.0, 3.0], "slider_layerview_margin": [3.0, 3.0],