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

View File

@ -15,7 +15,7 @@ Item {
height: buttons.height
property int activeY
RowLayout {
ColumnLayout {
id: buttons;
anchors.bottom: parent.bottom;
@ -35,7 +35,6 @@ Item {
checked: model.active;
enabled: UM.Selection.hasSelection;
property bool verticalTooltip: true;
style: UM.Theme.styles.tool_button;
//Workaround since using ToolButton"s onClicked would break the binding of the checked property, instead
@ -64,9 +63,9 @@ Item {
Rectangle {
id: panelBackground;
anchors.left: parent.left;
anchors.top: parent.bottom;
anchors.topMargin: UM.Theme.sizes.default_margin.width;
anchors.left: parent.right;
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
anchors.top: parent.top;
y: base.activeY
width: {

View File

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

View File

@ -203,7 +203,7 @@
"slider_groove": [0.5, 0.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_smalltext_margin": [0.3, 0.00],
"slider_layerview_margin": [3.0, 3.0],