Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MonitorInfoBlurb.qml « qml « resources « UM3NetworkPrinting « plugins - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1ec7eba03628ea3a3d9324c5a68ce1392cac3648 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.3
import QtQuick.Controls 2.0
import UM 1.5 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

        // Which way should the pop-up point? Default is up, but will flip when required
        direction: "up"

        // Use dark grey for info blurbs and white for context menus
        color: UM.Theme.getColor("monitor_tooltip")

        contentItem: Item
        {
            id: contentWrapper
            implicitWidth: childrenRect.width
            implicitHeight: innerLabel.contentHeight + 2 * innerLabel.padding
            UM.Label
            {
                id: innerLabel
                padding: 12 * screenScaleFactor // TODO: Theme!
                text: ""
                wrapMode: Text.WordWrap
                width: 240 * screenScaleFactor // TODO: Theme!
                color: UM.Theme.getColor("monitor_tooltip_text")
            }
        }
    }

    function open() {
        popUp.open()
    }
    function close() {
        popUp.close()
    }
}