~zsombi/ubuntu-ui-toolkit/50-custom-delegates

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
/*
 * Copyright 2014 Canonical Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
import QtQuick 2.2

Item {
    id: dividerStyle

    property color color: styledItem.backgroundColor

    // Do not make the following two colors part of the style API as they may be deprecated soon.
    property color topColor: Qt.darker(color, 1.1)
    property color bottomColor: Qt.lighter(color, 1.2)

    Rectangle {
        anchors.fill: parent
        color: dividerStyle.color

        gradient: Gradient {
            // top shadow
            GradientStop {
                position: 0.02
                color: dividerStyle.topColor
            }
            // middle (background)
            GradientStop {
                position: 0.05
                color: dividerStyle.color
            }
            GradientStop {
                position: 0.95
                color: dividerStyle.color
            }
            // bottom highlight
            GradientStop {
                position: 0.98
                color: dividerStyle.bottomColor
            }
        }
    }
}