Warning, /pim/kube/framework/qml/ListDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com>
0003  *  Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
0004  *
0005  *  This program is free software; you can redistribute it and/or modify
0006  *  it under the terms of the GNU General Public License as published by
0007  *  the Free Software Foundation; either version 2 of the License, or
0008  *  (at your option) any later version.
0009  *
0010  *  This program is distributed in the hope that it will be useful,
0011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0013  *  GNU General Public License for more details.
0014  *
0015  *  You should have received a copy of the GNU General Public License along
0016  *  with this program; if not, write to the Free Software Foundation, Inc.,
0017  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018  */
0019 
0020 import QtQuick 2.7
0021 import org.kube.framework 1.0 as Kube
0022 import QtQuick.Templates 2.0 as T
0023 
0024 T.ItemDelegate {
0025     id: root
0026     property variant currentData: model
0027     property alias color: background.color
0028     property alias border: background.border
0029     property color textColor: highlighted ? Kube.Colors.highlightedTextColor : Kube.Colors.textColor
0030     property color disabledTextColor: highlighted ? Kube.Colors.highlightedTextColor : Kube.Colors.disabledTextColor
0031     property bool focused: root.hovered || root.activeFocus
0032     property bool selectionEnabled: true
0033 
0034     height: Kube.Units.gridUnit * 3
0035     width: ListView.view.availableWidth
0036     hoverEnabled: true
0037     highlighted: ListView.isCurrentItem
0038 
0039     onClicked: {
0040         if (selectionEnabled) {
0041             ListView.view.currentIndex = index
0042             ListView.view.forceActiveFocus()
0043         }
0044     }
0045 
0046     background: Kube.DelegateBackground {
0047         id: background
0048         border.color: Kube.Colors.buttonColor
0049         border.width: 1
0050         color: Kube.Colors.viewBackgroundColor
0051         focused: root.focused
0052         selected: root.highlighted
0053     }
0054 }