mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 23:05:01 -06:00
Create MonitorInfoBlurb.qml
Contributes to CL-1165
This commit is contained in:
parent
e7b60a5290
commit
920b7b6706
1 changed files with 54 additions and 0 deletions
|
@ -0,0 +1,54 @@
|
|||
// Copyright (c) 2018 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.3
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Dialogs 1.1
|
||||
import UM 1.3 as UM
|
||||
|
||||
/**
|
||||
* A MonitorInfoBlurb is an extension of the GenericPopUp used to show static information (vs. interactive context
|
||||
* menus). It accepts some text (text), an item to link to to (target), and a specification of which side of the target
|
||||
* to appear on (direction). It also sets the GenericPopUp's color to black, to differentiate itself from a menu.
|
||||
*/
|
||||
Item
|
||||
{
|
||||
property alias text: innerLabel.text
|
||||
property alias target: popUp.target
|
||||
property alias direction: popUp.direction
|
||||
|
||||
GenericPopUp
|
||||
{
|
||||
id: popUp
|
||||
|
||||
// If the pop-up won't fit in the window, flip it
|
||||
direction: target.y + target.height + contentWrapper.implicitHeight < monitorFrame.height ? "top" : "bottom"
|
||||
|
||||
// Use dark grey for info blurbs and white for context menus
|
||||
color: "#191919" // TODO: Theme!
|
||||
|
||||
contentItem: Item
|
||||
{
|
||||
id: contentWrapper
|
||||
implicitWidth: childrenRect.width
|
||||
implicitHeight: innerLabel.contentHeight + 2 * innerLabel.padding
|
||||
Label
|
||||
{
|
||||
id: innerLabel
|
||||
padding: 12 * screenScaleFactor // TODO: Theme!
|
||||
text: ""
|
||||
wrapMode: Text.WordWrap
|
||||
width: 240 * screenScaleFactor // TODO: Theme!
|
||||
color: "white" // TODO: Theme!
|
||||
font: UM.Theme.getFont("default")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function open() {
|
||||
popUp.open()
|
||||
}
|
||||
function close() {
|
||||
popUp.close()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue