mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 06:05:52 +08:00
Merge branch '4.1' of github.com:Ultimaker/Cura
This commit is contained in:
commit
9e0d047815
@ -391,6 +391,7 @@ UM.MainWindow
|
|||||||
PrintSetupTooltip
|
PrintSetupTooltip
|
||||||
{
|
{
|
||||||
id: tooltip
|
id: tooltip
|
||||||
|
sourceWidth: UM.Theme.getSize("print_setup_widget").width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,13 @@ Item
|
|||||||
Custom = 1
|
Custom = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Catch all mouse events
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
}
|
||||||
|
|
||||||
// Set the current mode index to the value that is stored in the preferences or Recommended mode otherwise.
|
// Set the current mode index to the value that is stored in the preferences or Recommended mode otherwise.
|
||||||
property int currentModeIndex:
|
property int currentModeIndex:
|
||||||
{
|
{
|
||||||
@ -194,7 +201,13 @@ Item
|
|||||||
{
|
{
|
||||||
h -= mouse_absolute_y - base.height;
|
h -= mouse_absolute_y - base.height;
|
||||||
}
|
}
|
||||||
|
// Enforce a minimum size (again).
|
||||||
|
// This is a bit of a hackish way to do it, but we've seen some ocasional reports that the size
|
||||||
|
// could get below the the minimum height.
|
||||||
|
if(h < absoluteMinimumHeight)
|
||||||
|
{
|
||||||
|
h = absoluteMinimumHeight;
|
||||||
|
}
|
||||||
UM.Preferences.setValue("view/settings_list_height", h);
|
UM.Preferences.setValue("view/settings_list_height", h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2015 Ultimaker B.V.
|
// Copyright (c) 2019 Ultimaker B.V.
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
@ -6,26 +6,43 @@ import QtQuick.Controls 2.3
|
|||||||
|
|
||||||
import UM 1.0 as UM
|
import UM 1.0 as UM
|
||||||
|
|
||||||
UM.PointingRectangle {
|
UM.PointingRectangle
|
||||||
id: base;
|
{
|
||||||
|
id: base
|
||||||
width: UM.Theme.getSize("tooltip").width;
|
property real sourceWidth: 0
|
||||||
height: label.height + UM.Theme.getSize("tooltip_margins").height * 2;
|
width: UM.Theme.getSize("tooltip").width
|
||||||
color: UM.Theme.getColor("tooltip");
|
height: label.height + UM.Theme.getSize("tooltip_margins").height * 2
|
||||||
|
color: UM.Theme.getColor("tooltip")
|
||||||
|
|
||||||
arrowSize: UM.Theme.getSize("default_arrow").width
|
arrowSize: UM.Theme.getSize("default_arrow").width
|
||||||
|
|
||||||
opacity: 0;
|
opacity: 0
|
||||||
Behavior on opacity { NumberAnimation { duration: 100; } }
|
|
||||||
|
|
||||||
property alias text: label.text;
|
Behavior on opacity
|
||||||
|
{
|
||||||
|
NumberAnimation { duration: 100; }
|
||||||
|
}
|
||||||
|
|
||||||
function show(position) {
|
property alias text: label.text
|
||||||
if(position.y + base.height > parent.height) {
|
|
||||||
|
function show(position)
|
||||||
|
{
|
||||||
|
if(position.y + base.height > parent.height)
|
||||||
|
{
|
||||||
x = position.x - base.width;
|
x = position.x - base.width;
|
||||||
y = parent.height - base.height;
|
y = parent.height - base.height;
|
||||||
} else {
|
} else
|
||||||
x = position.x - base.width;
|
{
|
||||||
|
var new_x = x = position.x - base.width
|
||||||
|
|
||||||
|
// If the tooltip would fall out of the screen, display it on the other side.
|
||||||
|
if(new_x < 0)
|
||||||
|
{
|
||||||
|
new_x = x + sourceWidth + base.width
|
||||||
|
}
|
||||||
|
|
||||||
|
x = new_x
|
||||||
|
|
||||||
y = position.y - UM.Theme.getSize("tooltip_arrow_margins").height;
|
y = position.y - UM.Theme.getSize("tooltip_arrow_margins").height;
|
||||||
if(y < 0)
|
if(y < 0)
|
||||||
{
|
{
|
||||||
@ -37,14 +54,16 @@ UM.PointingRectangle {
|
|||||||
target = Qt.point(position.x + 1, position.y + Math.round(UM.Theme.getSize("tooltip_arrow_margins").height / 2))
|
target = Qt.point(position.x + 1, position.y + Math.round(UM.Theme.getSize("tooltip_arrow_margins").height / 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide() {
|
function hide()
|
||||||
|
{
|
||||||
base.opacity = 0;
|
base.opacity = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
id: label;
|
id: label;
|
||||||
anchors {
|
anchors
|
||||||
|
{
|
||||||
top: parent.top;
|
top: parent.top;
|
||||||
topMargin: UM.Theme.getSize("tooltip_margins").height;
|
topMargin: UM.Theme.getSize("tooltip_margins").height;
|
||||||
left: parent.left;
|
left: parent.left;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user