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;
|
id: openFileButton;
|
||||||
//style: UM.Backend.progress < 0 ? UM.Theme.styles.open_file_button : UM.Theme.styles.tool_button;
|
//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");
|
text: catalog.i18nc("@action:button","Open File");
|
||||||
iconSource: UM.Theme.icons.load
|
iconSource: UM.Theme.icons.load
|
||||||
style: UM.Theme.styles.open_file_button
|
style: UM.Theme.styles.tool_button
|
||||||
tooltip: '';
|
tooltip: '';
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
@ -368,6 +367,14 @@ UM.MainWindow
|
|||||||
action: actions.open;
|
action: actions.open;
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
onEntered: {
|
||||||
|
buttonTooltip.targetId = parent;
|
||||||
|
mouse.accepted = false;
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
buttonTooltip.targetId = undefined;
|
||||||
|
mouse.accepted = false;
|
||||||
|
}
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButton
|
||||||
}
|
}
|
||||||
@ -645,7 +652,7 @@ UM.MainWindow
|
|||||||
id: openDialog;
|
id: openDialog;
|
||||||
|
|
||||||
//: File open dialog title
|
//: 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;
|
modality: UM.Application.platform == "linux" ? Qt.NonModal : Qt.WindowModal;
|
||||||
//TODO: Support multiple file selection, workaround bug in KDE file dialog
|
//TODO: Support multiple file selection, workaround bug in KDE file dialog
|
||||||
//selectMultiple: true
|
//selectMultiple: true
|
||||||
|
@ -13,7 +13,7 @@ Item {
|
|||||||
|
|
||||||
width: buttons.width;
|
width: buttons.width;
|
||||||
height: buttons.height
|
height: buttons.height
|
||||||
property int activeY
|
//property int activeY
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: buttons;
|
id: buttons;
|
||||||
@ -44,29 +44,21 @@ Item {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
parent.checked ? UM.Controller.setActiveTool(null) : UM.Controller.setActiveTool(model.id);
|
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 {
|
Rectangle {
|
||||||
id: panelBackground;
|
id: panelBackground;
|
||||||
|
|
||||||
anchors.left: parent.right;
|
anchors.left: parent.right;
|
||||||
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
|
anchors.leftMargin: UM.Theme.sizes.default_margin.width;
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
y: base.activeY
|
//y: base.activeY
|
||||||
|
z: buttons.z -1
|
||||||
|
|
||||||
width: {
|
width: {
|
||||||
if (panel.item && panel.width > 0){
|
if (panel.item && panel.width > 0){
|
||||||
|
@ -42,6 +42,7 @@ QtObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
property Component open_file_button: Component {
|
property Component open_file_button: Component {
|
||||||
ButtonStyle {
|
ButtonStyle {
|
||||||
background: Item{
|
background: Item{
|
||||||
@ -86,6 +87,7 @@ QtObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
property Component tool_button: Component {
|
property Component tool_button: Component {
|
||||||
ButtonStyle {
|
ButtonStyle {
|
||||||
@ -93,23 +95,31 @@ QtObject {
|
|||||||
implicitWidth: UM.Theme.sizes.button.width;
|
implicitWidth: UM.Theme.sizes.button.width;
|
||||||
implicitHeight: UM.Theme.sizes.button.height;
|
implicitHeight: UM.Theme.sizes.button.height;
|
||||||
|
|
||||||
Rectangle {
|
UM.PointingRectangle {
|
||||||
id: tool_button_background
|
id: button_tooltip
|
||||||
|
|
||||||
anchors.left: parent.right
|
anchors.left: parent.right
|
||||||
|
anchors.leftMargin: UM.Theme.sizes.button_tooltip_arrow.width * 2
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
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;
|
opacity: control.hovered ? 1.0 : 0.0;
|
||||||
|
|
||||||
width: control.hovered ? label.width : 0;
|
width: control.hovered ? button_tip.width + UM.Theme.sizes.button_tooltip.width : 0
|
||||||
height: label.height
|
height: UM.Theme.sizes.button_tooltip.height
|
||||||
|
|
||||||
Behavior on width { NumberAnimation { duration: 100; } }
|
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: button_tip
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
text: control.text
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
|
||||||
|
text: control.text;
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -166,6 +176,8 @@ QtObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
property Component tool_button_panel: Component {
|
property Component tool_button_panel: Component {
|
||||||
ButtonStyle {
|
ButtonStyle {
|
||||||
background: Item {
|
background: Item {
|
||||||
@ -231,7 +243,7 @@ QtObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
property Component progressbar: Component{
|
property Component progressbar: Component{
|
||||||
ProgressBarStyle {
|
ProgressBarStyle {
|
||||||
|
@ -29,8 +29,7 @@
|
|||||||
"letterSpacing": 2.0
|
"letterSpacing": 2.0
|
||||||
},
|
},
|
||||||
"button_tooltip": {
|
"button_tooltip": {
|
||||||
"size": 0.75,
|
"size": 1.0,
|
||||||
"capitalize": true,
|
|
||||||
"family": "Proxima Nova Rg"
|
"family": "Proxima Nova Rg"
|
||||||
},
|
},
|
||||||
"setting_category": {
|
"setting_category": {
|
||||||
@ -72,7 +71,10 @@
|
|||||||
"button_text": [255, 255, 255, 255],
|
"button_text": [255, 255, 255, 255],
|
||||||
"button_disabled": [24, 41, 77, 255],
|
"button_disabled": [24, 41, 77, 255],
|
||||||
"button_disabled_text": [70, 84, 113, 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": [24, 41, 77, 255],
|
||||||
"toggle_checked_border": [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": [127, 127, 127, 255],
|
||||||
"setting_control_border_highlight": [12, 169, 227, 255],
|
"setting_control_border_highlight": [12, 169, 227, 255],
|
||||||
"setting_control_text": [24, 41, 77, 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_control_revert": [127, 127, 127, 255],
|
||||||
"setting_unit": [127, 127, 127, 255],
|
"setting_unit": [127, 127, 127, 255],
|
||||||
"setting_validation_error": [255, 57, 14, 255],
|
"setting_validation_error": [255, 57, 14, 255],
|
||||||
@ -194,6 +196,9 @@
|
|||||||
"button_icon": [3, 3],
|
"button_icon": [3, 3],
|
||||||
"button_lining": [0, 0],
|
"button_lining": [0, 0],
|
||||||
|
|
||||||
|
"button_tooltip": [1.2, 1.2],
|
||||||
|
"button_tooltip_arrow": [0.25, 0.25],
|
||||||
|
|
||||||
"progressbar": [26.0, 0.8],
|
"progressbar": [26.0, 0.8],
|
||||||
"progressbar_radius": [0.4, 0.4],
|
"progressbar_radius": [0.4, 0.4],
|
||||||
"progressbar_control": [8.0, 0.8],
|
"progressbar_control": [8.0, 0.8],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user