mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Add a Cura Tooltip to show in some buttons
Contributes to CURA-6004.
This commit is contained in:
parent
15f81da95b
commit
2bf641efcf
8 changed files with 59 additions and 11 deletions
|
@ -16,7 +16,7 @@ Button
|
||||||
property alias iconSource: buttonIconLeft.source
|
property alias iconSource: buttonIconLeft.source
|
||||||
property alias textFont: buttonText.font
|
property alias textFont: buttonText.font
|
||||||
property alias cornerRadius: backgroundRect.radius
|
property alias cornerRadius: backgroundRect.radius
|
||||||
property alias tooltip: tooltip.text
|
property alias tooltip: tooltip.tooltipText
|
||||||
property alias cornerSide: backgroundRect.cornerSide
|
property alias cornerSide: backgroundRect.cornerSide
|
||||||
|
|
||||||
property color color: UM.Theme.getColor("primary")
|
property color color: UM.Theme.getColor("primary")
|
||||||
|
@ -109,11 +109,9 @@ Button
|
||||||
z: backgroundRect.z - 1
|
z: backgroundRect.z - 1
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolTip
|
Cura.ToolTip
|
||||||
{
|
{
|
||||||
id: tooltip
|
id: tooltip
|
||||||
text: ""
|
show: button.hovered
|
||||||
delay: 500
|
|
||||||
visible: text != "" && button.hovered
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -55,7 +55,6 @@ Item
|
||||||
|
|
||||||
leftPadding: UM.Theme.getSize("narrow_margin").width //Need more space than usual here for wide text.
|
leftPadding: UM.Theme.getSize("narrow_margin").width //Need more space than usual here for wide text.
|
||||||
rightPadding: UM.Theme.getSize("narrow_margin").width
|
rightPadding: UM.Theme.getSize("narrow_margin").width
|
||||||
tooltip: popup.opened ? "" : catalog.i18nc("@info:tooltip", "Select the active output device")
|
|
||||||
iconSource: popup.opened ? UM.Theme.getIcon("arrow_top") : UM.Theme.getIcon("arrow_bottom")
|
iconSource: popup.opened ? UM.Theme.getIcon("arrow_top") : UM.Theme.getIcon("arrow_bottom")
|
||||||
color: UM.Theme.getColor("action_panel_secondary")
|
color: UM.Theme.getColor("action_panel_secondary")
|
||||||
visible: (devicesModel.deviceCount > 1)
|
visible: (devicesModel.deviceCount > 1)
|
||||||
|
|
|
@ -109,6 +109,7 @@ Column
|
||||||
fixedWidthMode: true
|
fixedWidthMode: true
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
text: catalog.i18nc("@button", "Slice")
|
text: catalog.i18nc("@button", "Slice")
|
||||||
|
tooltip: "Start slicing process"
|
||||||
enabled: widget.backendState != UM.Backend.Error
|
enabled: widget.backendState != UM.Backend.Error
|
||||||
visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error
|
visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error
|
||||||
onClicked: sliceOrStopSlicing()
|
onClicked: sliceOrStopSlicing()
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
// 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
|
||||||
import QtQuick.Controls 1.1
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Controls.Styles 1.1
|
|
||||||
import QtQuick.Layouts 1.1
|
|
||||||
|
|
||||||
import UM 1.0 as UM
|
import UM 1.0 as UM
|
||||||
|
|
||||||
|
@ -57,5 +55,6 @@ UM.PointingRectangle {
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
font: UM.Theme.getFont("default");
|
font: UM.Theme.getFont("default");
|
||||||
color: UM.Theme.getColor("tooltip_text");
|
color: UM.Theme.getColor("tooltip_text");
|
||||||
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
43
resources/qml/ToolTip.qml
Normal file
43
resources/qml/ToolTip.qml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.7
|
||||||
|
import QtQuick.Controls 2.3
|
||||||
|
|
||||||
|
import UM 1.0 as UM
|
||||||
|
|
||||||
|
ToolTip
|
||||||
|
{
|
||||||
|
// This property indicates when the tooltip has to show, for instance when a button is hovered
|
||||||
|
property bool show: false
|
||||||
|
|
||||||
|
property alias tooltipText: tooltip.text
|
||||||
|
property var targetPoint: Qt.point(0, 0)
|
||||||
|
|
||||||
|
id: tooltip
|
||||||
|
text: ""
|
||||||
|
delay: 500
|
||||||
|
visible: text != "" && show
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
|
||||||
|
background: UM.PointingRectangle
|
||||||
|
{
|
||||||
|
id: backgroundRect
|
||||||
|
color: UM.Theme.getColor("tooltip")
|
||||||
|
|
||||||
|
target: Qt.point(targetPoint.x - tooltip.x, targetPoint.y - tooltip.y)
|
||||||
|
|
||||||
|
arrowSize: UM.Theme.getSize("default_arrow").width
|
||||||
|
}
|
||||||
|
|
||||||
|
contentItem: Label
|
||||||
|
{
|
||||||
|
id: label
|
||||||
|
text: tooltip.text
|
||||||
|
font: tooltip.font
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
textFormat: Text.RichText
|
||||||
|
color: UM.Theme.getColor("tooltip_text")
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
}
|
|
@ -96,4 +96,11 @@ Button
|
||||||
height: UM.Theme.getSize("button_icon").height
|
height: UM.Theme.getSize("button_icon").height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cura.ToolTip
|
||||||
|
{
|
||||||
|
id: tooltip
|
||||||
|
tooltipText: base.text
|
||||||
|
show: base.hovered
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,4 +14,5 @@ PrinterTypeLabel 1.0 PrinterTypeLabel.qml
|
||||||
ViewsSelector 1.0 ViewsSelector.qml
|
ViewsSelector 1.0 ViewsSelector.qml
|
||||||
ToolbarButton 1.0 ToolbarButton.qml
|
ToolbarButton 1.0 ToolbarButton.qml
|
||||||
SettingView 1.0 SettingView.qml
|
SettingView 1.0 SettingView.qml
|
||||||
ProfileMenu 1.0 ProfileMenu.qml
|
ProfileMenu 1.0 ProfileMenu.qml
|
||||||
|
ToolTip 1.0 ToolTip.qml
|
|
@ -240,7 +240,7 @@
|
||||||
"checkbox_disabled": [223, 223, 223, 255],
|
"checkbox_disabled": [223, 223, 223, 255],
|
||||||
"checkbox_text": [35, 35, 35, 255],
|
"checkbox_text": [35, 35, 35, 255],
|
||||||
|
|
||||||
"tooltip": [68, 192, 255, 255],
|
"tooltip": [19, 19, 19, 255],
|
||||||
"tooltip_text": [255, 255, 255, 255],
|
"tooltip_text": [255, 255, 255, 255],
|
||||||
|
|
||||||
"tool_button_border": [255, 255, 255, 0],
|
"tool_button_border": [255, 255, 255, 0],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue