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

TableView.qml « qml « resources - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: db495c3dc2855d99d50bf3d61faba8737d399dd1 (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
// Copyright (C) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.10
import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one
import QtQuick.Controls 2.3
import QtQuick.Controls.Styles 1.4

import UM 1.5 as UM


OldControls.TableView
{
    itemDelegate: Item
    {
        height: tableCellLabel.implicitHeight

        UM.Label
        {
            id: tableCellLabel
            color: styleData.selected ? UM.Theme.getColor("primary_button_text") : UM.Theme.getColor("text")
            elide: Text.ElideRight
            text: styleData.value
            anchors.fill: parent
            anchors.leftMargin: 10 * screenScaleFactor
        }
    }

    rowDelegate: Rectangle
    {
        color: styleData.selected ? UM.Theme.getColor("primary_button") : UM.Theme.getColor("main_background")
        height: UM.Theme.getSize("table_row").height
    }

    // Use the old styling technique since it's the only way to make the scrollbars themed in the TableView
    style: TableViewStyle
    {
        backgroundColor: UM.Theme.getColor("main_background")

        handle: Rectangle
        {
            // Both implicit width and height have to be set, since the handle is used by both the horizontal and the vertical scrollbars
            implicitWidth: UM.Theme.getSize("scrollbar").width
            implicitHeight: UM.Theme.getSize("scrollbar").width
            radius: width / 2
            color: UM.Theme.getColor(styleData.pressed ? "scrollbar_handle_down" : (styleData.hovered ? "scrollbar_handle_hover" : "scrollbar_handle"))
        }

        scrollBarBackground: Rectangle
        {
            // Both implicit width and height have to be set, since the handle is used by both the horizontal and the vertical scrollbars
            implicitWidth: UM.Theme.getSize("scrollbar").width
            implicitHeight: UM.Theme.getSize("scrollbar").width
            color: UM.Theme.getColor("main_background")
        }

        // The little rectangle between the vertical and horizontal scrollbars
        corner: Rectangle
        {
            color: UM.Theme.getColor("main_background")
        }

        // Override the control arrows
        incrementControl: Item { }
        decrementControl: Item { }
    }
}