SectionDelegate.qml 1.84 KB
Newer Older
1
2
3
/*
    Copyright (C) 2011  Martin Gräßlin <mgraesslin@kde.org>
    Copyright (C) 2012 Marco Martin <mart@kde.org>
Mikel Johnson's avatar
Mikel Johnson committed
4
    Copyright (C) 2021 by Mikel Johnson <mikel5764@gmail.com>
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

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    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 General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras


Item {
    id: sectionDelegate

    width: parent.width
    height: childrenRect.height

    PlasmaExtras.Heading {
        id: sectionHeading
        anchors {
            left: parent.left
35
            leftMargin: PlasmaCore.Units.gridUnit
Mikel Johnson's avatar
Mikel Johnson committed
36
            right: parent.right
37
38
        }

Mikel Johnson's avatar
Mikel Johnson committed
39
40
        // important for RTL (otherwise label won't reverse)
        horizontalAlignment: Text.AlignLeft
41
        y: Math.round(PlasmaCore.Units.gridUnit / 4)
42
        level: 4
43
44
45
        // Force it to be uppercase or else if the first item in a section starts
        // with a lowercase letter, the header letter will be lowercase too!
        text: section.toUpperCase()
46
47
48
    }
    Item {
        width: parent.width
49
        height: Math.round(PlasmaCore.Units.gridUnit / 4)
50
51
52
53
        anchors.left: parent.left
        anchors.top: sectionHeading.bottom
    }
} // sectionDelegate