This commit is contained in:
Jaime van Kessel 2015-04-20 12:02:02 +02:00
commit e8dc563c46
5 changed files with 51 additions and 44 deletions

View File

@ -8,22 +8,4 @@ import UM 1.0 as UM
Button { Button {
id: base; id: base;
style: UM.Theme.styles.tool_button; style: UM.Theme.styles.tool_button;
Rectangle {
anchors.bottom: parent.top;
width: parent.width;
height: base.hovered ? label.height : 0;
Behavior on height { NumberAnimation { duration: 75; } }
opacity: base.hovered ? 1.0 : 0.0;
Behavior on opacity { NumberAnimation { duration: 75; } }
Label {
id: label
anchors.horizontalCenter: parent.horizontalCenter;
text: base.text;
font: UM.Theme.fonts.button_tooltip;
}
}
} }

View File

@ -5,30 +5,53 @@ import QtQuick.Layouts 1.1
import UM 1.0 as UM import UM 1.0 as UM
RowLayout { Item {
id: base; id: base;
spacing: UM.Theme.sizes.default_margin.width * 2; width: buttons.width;
height: buttons.height + panel.height;
Repeater { RowLayout {
id: repeat id: buttons;
model: UM.Models.toolModel anchors.bottom: parent.bottom;
anchors.left: parent.left;
PrinterButton { spacing: UM.Theme.sizes.default_margin.width * 2;
text: model.name;
iconSource: UM.Theme.icons[model.icon];
tooltip: model.description;
checkable: true; Repeater {
checked: model.active; id: repeat
//Workaround since using ToolButton's onClicked would break the binding of the checked property, instead model: UM.Models.toolModel
//just catch the click so we do not trigger that behaviour.
MouseArea { PrinterButton {
anchors.fill: parent; text: model.name;
onClicked: parent.checked ? UM.Controller.setActiveTool(null) : UM.Controller.setActiveTool(model.id); iconSource: UM.Theme.icons[model.icon];
tooltip: model.description;
checkable: true;
checked: model.active;
//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.
MouseArea {
anchors.fill: parent;
onClicked: parent.checked ? UM.Controller.setActiveTool(null) : UM.Controller.setActiveTool(model.id);
}
} }
} }
} }
Loader {
id: panel
anchors.left: parent.left;
anchors.right: parent.right;
anchors.bottom: buttons.top;
anchors.bottomMargin: UM.Theme.sizes.default_margin.height;
height: childrenRect.height;
source: UM.ActiveTool.valid ? UM.ActiveTool.activeToolPanel : "";
}
} }

View File

@ -15,7 +15,6 @@ UM.AngledCornerRectangle {
cornerSize: UM.Theme.sizes.default_margin.width; cornerSize: UM.Theme.sizes.default_margin.width;
function showTooltip(item, position, text) { function showTooltip(item, position, text) {
print("omg zomg")
tooltip.text = text; tooltip.text = text;
position = item.mapToItem(base, position.x, position.y); position = item.mapToItem(base, position.x, position.y);
tooltip.show(position); tooltip.show(position);
@ -72,16 +71,19 @@ UM.AngledCornerRectangle {
onLoaded: onLoaded:
{ {
if(item) item.configureSettings = base.configureMachinesAction; if(item)
if(typeof(item.onShowTooltip) != 'undefined')
{ {
item.showTooltip.connect(base.showTooltip) item.configureSettings = base.configureMachinesAction;
if(item.onShowTooltip != undefined)
{
item.showTooltip.connect(base.showTooltip)
}
if(item.onHideTooltip != undefined)
{
item.hideTooltip.connect(base.hideTooltip)
}
} }
} }
//onShowTooltip: base.showTooltip(item,position,text)
//onHideTooltip: base.hideTooltip()
} }
SaveButton { SaveButton {

View File

@ -1,3 +1,3 @@
import UM 1.0 as UM import UM 1.0 as UM
UM.SettingView{} UM.SettingView { }

View File

@ -110,7 +110,7 @@ Column {
height: UM.Theme.sizes.section.height; height: UM.Theme.sizes.section.height;
iconSource: UM.Theme.icons.printsetup; iconSource: UM.Theme.icons.printsetup;
text: qsTr("Setup"); text: qsTr("Print Setup");
enabled: false; enabled: false;
color: UM.Theme.colors.primary; color: UM.Theme.colors.primary;