mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-09-13 20:23:12 +08:00
Use pointingrectangle for toolbutton tooltips
This commit is contained in:
parent
1d27822970
commit
ec46b49847
@ -353,10 +353,9 @@ UM.MainWindow
|
||||
{
|
||||
id: openFileButton;
|
||||
//style: UM.Backend.progress < 0 ? UM.Theme.styles.open_file_button : UM.Theme.styles.tool_button;
|
||||
//style: UM.Theme.styles.open_file_button
|
||||
text: catalog.i18nc("@action:button","Open File");
|
||||
iconSource: UM.Theme.icons.load
|
||||
style: UM.Theme.styles.open_file_button
|
||||
style: UM.Theme.styles.tool_button
|
||||
tooltip: '';
|
||||
anchors
|
||||
{
|
||||
@ -368,6 +367,14 @@ UM.MainWindow
|
||||
action: actions.open;
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onEntered: {
|
||||
buttonTooltip.targetId = parent;
|
||||
mouse.accepted = false;
|
||||
}
|
||||
onExited: {
|
||||
buttonTooltip.targetId = undefined;
|
||||
mouse.accepted = false;
|
||||
}
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.NoButton
|
||||
}
|
||||
@ -645,7 +652,7 @@ UM.MainWindow
|
||||
id: openDialog;
|
||||
|
||||
//: File open dialog title
|
||||
title: catalog.i18nc("@title:window","Open File")
|
||||
title: catalog.i18nc("@title:window","Open file")
|
||||
modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal;
|
||||
//TODO: Support multiple file selection, workaround bug in KDE file dialog
|
||||
//selectMultiple: true
|
||||
|
@ -13,7 +13,7 @@ Item {
|
||||
|
||||
width: buttons.width;
|
||||
height: buttons.height
|
||||
property int activeY
|
||||
//property int activeY
|
||||
|
||||
ColumnLayout {
|
||||
id: buttons;
|
||||
@ -44,29 +44,21 @@ Item {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
parent.checked ? UM.Controller.setActiveTool(null) : UM.Controller.setActiveTool(model.id);
|
||||
base.activeY = parent.y
|
||||
//base.activeY = parent.y
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: base.width
|
||||
height: base.height
|
||||
z: parent.z - 1
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
color: UM.Theme.colors.lining
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: panelBackground;
|
||||
|
||||
anchors.left: parent.right;
|
||||
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
|
||||
anchors.top: parent.top;
|
||||
y: base.activeY
|
||||
//y: base.activeY
|
||||
z: buttons.z -1
|
||||
|
||||
width: {
|
||||
if (panel.item && panel.width > 0){
|
||||
|
@ -42,6 +42,7 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
property Component open_file_button: Component {
|
||||
ButtonStyle {
|
||||
background: Item{
|
||||
@ -86,6 +87,7 @@ QtObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
property Component tool_button: Component {
|
||||
ButtonStyle {
|
||||
@ -93,23 +95,31 @@ QtObject {
|
||||
implicitWidth: UM.Theme.sizes.button.width;
|
||||
implicitHeight: UM.Theme.sizes.button.height;
|
||||
|
||||
Rectangle {
|
||||
id: tool_button_background
|
||||
UM.PointingRectangle {
|
||||
id: button_tooltip
|
||||
|
||||
anchors.left: parent.right
|
||||
anchors.leftMargin: UM.Theme.sizes.button_tooltip_arrow.width * 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
target: Qt.point(parent.x, y + height/2)
|
||||
arrowSize: UM.Theme.sizes.button_tooltip_arrow.width
|
||||
color: UM.Theme.colors.button_tooltip
|
||||
opacity: control.hovered ? 1.0 : 0.0;
|
||||
|
||||
width: control.hovered ? label.width : 0;
|
||||
height: label.height
|
||||
width: control.hovered ? button_tip.width + UM.Theme.sizes.button_tooltip.width : 0
|
||||
height: UM.Theme.sizes.button_tooltip.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
|
||||
id: button_tip
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter;
|
||||
|
||||
text: control.text;
|
||||
font: UM.Theme.fonts.button_tooltip;
|
||||
color: UM.Theme.colors.button_tooltip_text;
|
||||
}
|
||||
@ -166,6 +176,8 @@ QtObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
property Component tool_button_panel: Component {
|
||||
ButtonStyle {
|
||||
background: Item {
|
||||
@ -231,7 +243,7 @@ QtObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
property Component progressbar: Component{
|
||||
ProgressBarStyle {
|
||||
|
@ -29,8 +29,7 @@
|
||||
"letterSpacing": 2.0
|
||||
},
|
||||
"button_tooltip": {
|
||||
"size": 0.75,
|
||||
"capitalize": true,
|
||||
"size": 1.0,
|
||||
"family": "Proxima Nova Rg"
|
||||
},
|
||||
"setting_category": {
|
||||
@ -72,7 +71,10 @@
|
||||
"button_text": [255, 255, 255, 255],
|
||||
"button_disabled": [24, 41, 77, 255],
|
||||
"button_disabled_text": [70, 84, 113, 255],
|
||||
"button_tooltip_text": [35, 35, 35, 255],
|
||||
|
||||
"button_tooltip": [24, 41, 77, 255],
|
||||
"button_tooltip_border": [245, 245, 245, 255],
|
||||
"button_tooltip_text": [255, 255, 255, 255],
|
||||
|
||||
"toggle_checked": [24, 41, 77, 255],
|
||||
"toggle_checked_border": [24, 41, 77, 255],
|
||||
@ -123,7 +125,7 @@
|
||||
"setting_control_border": [127, 127, 127, 255],
|
||||
"setting_control_border_highlight": [12, 169, 227, 255],
|
||||
"setting_control_text": [24, 41, 77, 255],
|
||||
"setting_control_depth_line": [162, 192, 227, 255],
|
||||
"setting_control_depth_line": [127, 127, 127, 255],
|
||||
"setting_control_revert": [127, 127, 127, 255],
|
||||
"setting_unit": [127, 127, 127, 255],
|
||||
"setting_validation_error": [255, 57, 14, 255],
|
||||
@ -194,6 +196,9 @@
|
||||
"button_icon": [3, 3],
|
||||
"button_lining": [0, 0],
|
||||
|
||||
"button_tooltip": [1.2, 1.2],
|
||||
"button_tooltip_arrow": [0.25, 0.25],
|
||||
|
||||
"progressbar": [26.0, 0.8],
|
||||
"progressbar_radius": [0.4, 0.4],
|
||||
"progressbar_control": [8.0, 0.8],
|
||||
|
Loading…
x
Reference in New Issue
Block a user