CardsView.qml 1.03 KB
Newer Older
1 2
import QtQuick 2.9
import QtQuick.Controls 2.2
camilo higuita's avatar
camilo higuita committed
3
import org.kde.kirigami 2.7 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
camilo higuita's avatar
camilo higuita committed
13
    readonly property  int defaultSize : Maui.Style.unit * 200
Camilo Higuita's avatar
Camilo Higuita committed
14
    property int itemWidth : !gridView ?  width :
camilo higuita's avatar
camilo higuita committed
15 16 17
                                        (isMobile ? width * 0.5 : Maui.Style.unit * 400)
    property int itemHeight: Maui.Style.unit * 180
    property int itemSpacing:  Maui.Style.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
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
}