CardsView.qml 1006 Bytes
Newer Older
1 2 3
import QtQuick 2.9
import QtQuick.Controls 2.2
import org.kde.kirigami 2.2 as Kirigami
Camilo Higuita's avatar
Camilo Higuita committed
4
import org.kde.mauikit 1.0 as Maui
5 6 7

GridView
{
8
    id: control
9 10
    property bool gridView : true

11
    property alias holder : holder
Camilo Higuita's avatar
Camilo Higuita committed
12
    property alias menu : cardMenu
13
    readonly property  int defaultSize : unit * 200
Camilo Higuita's avatar
Camilo Higuita committed
14
    property int itemWidth : !gridView ?  width :
15
                                        (isMobile ? width * 0.5 : unit * 400)
16
    property int itemHeight: unit * 180
17
    property int itemSpacing:  space.huge
18

19
    signal itemClicked(int index)
20
    boundsBehavior: !isMobile? Flickable.StopAtBounds : Flickable.DragAndOvershootBounds
21

22
    cellWidth: width > itemWidth ? width/2 : width
23
    cellHeight: itemHeight + itemSpacing
24
    topMargin: Kirigami.Units.largeSpacing * 2
25
    clip : true
26

27 28 29
    Maui.Holder
    {
        id: holder
Camilo Higuita's avatar
Camilo Higuita committed
30
        visible: count < 1
Camilo Higuita's avatar
Camilo Higuita committed
31
        z: 999
Camilo Higuita's avatar
Camilo Higuita committed
32 33 34 35 36
    }

    CardMenu
    {
        id: cardMenu
37 38
    }

39
    ScrollBar.vertical: ScrollBar{ id:scrollBar; visible: !isMobile}
40
}