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

DropDownHeader.qml « WelcomePages « qml « resources - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b91f3383befacaa1ad701f5346bec095cafce2fb (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.10
import QtQuick.Controls 2.3

import UM 1.5 as UM
import Cura 1.1 as Cura

import ".."


//
// This is DropDown Header bar of the expandable drop down list. See comments in DropDownWidget for details.
//
Cura.RoundedRectangle
{
    UM.I18nCatalog { id: catalog; name: "cura" }

    id: base

    border.width: UM.Theme.getSize("default_lining").width
    border.color: UM.Theme.getColor("lining")
    color: UM.Theme.getColor("secondary")
    radius: UM.Theme.getSize("default_radius").width

    cornerSide: contentShown ? Cura.RoundedRectangle.Direction.Up : Cura.RoundedRectangle.Direction.All

    property string title: ""
    property url rightIconSource: UM.Theme.getIcon("ChevronSingleDown")

    // If the tab is under hovering state
    property bool hovered: false
    // If the content is shown
    property bool contentShown: false

    signal clicked()

    MouseArea
    {
        anchors.fill: parent
        hoverEnabled: true
        onEntered: base.hovered = true
        onExited: base.hovered = false

        onClicked: base.clicked()
    }

    UM.Label
    {
        id: title
        anchors.left: parent.left
        anchors.leftMargin: UM.Theme.getSize("default_margin").width
        anchors.verticalCenter: parent.verticalCenter
        text: base.title
        font: UM.Theme.getFont("medium")
        color: base.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text")
    }

    UM.ColorImage
    {
        id: rightIcon
        anchors.right: parent.right
        anchors.rightMargin: UM.Theme.getSize("default_margin").width
        anchors.verticalCenter: parent.verticalCenter
        width: UM.Theme.getSize("message_close").width
        height: UM.Theme.getSize("message_close").height
        color: base.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text")
        source: base.rightIconSource
    }
}