Warning, /education/minuet/src/app/qml/ImageItemDelegate.qml is written in an unsupported language. File is not indexed.
0001 /****************************************************************************
0002 **
0003 ** Copyright (C) 2016 by Sandro S. Andrade <sandroandrade@kde.org>
0004 **
0005 ** This program is free software; you can redistribute it and/or
0006 ** modify it under the terms of the GNU General Public License as
0007 ** published by the Free Software Foundation; either version 2 of
0008 ** the License or (at your option) version 3 or any later version
0009 ** accepted by the membership of KDE e.V. (or its successor approved
0010 ** by the membership of KDE e.V.), which shall act as a proxy
0011 ** defined in Section 14 of version 3 of the license.
0012 **
0013 ** This program is distributed in the hope that it will be useful,
0014 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
0015 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0016 ** GNU General Public License for more details.
0017 **
0018 ** You should have received a copy of the GNU General Public License
0019 ** along with this program. If not, see <http://www.gnu.org/licenses/>.
0020 **
0021 ****************************************************************************/
0022
0023 import QtQuick 2.7
0024 import QtQuick.Templates 2.0 as T
0025
0026 T.ItemDelegate {
0027 id: control
0028
0029 implicitWidth: Math.max(background ? background.implicitWidth : 0,
0030 contentItem.implicitWidth + leftPadding + rightPadding)
0031 implicitHeight: Math.max(background ? background.implicitHeight : 0,
0032 Math.max(contentItem.implicitHeight,
0033 indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
0034 baselineOffset: contentItem.y + contentItem.baselineOffset
0035
0036 padding: 12
0037 spacing: 12
0038
0039 //! [contentItem]
0040 contentItem: Row {
0041 spacing: 5
0042 Image {
0043 width: 22; height: 22
0044 source: (modelData._icon != undefined) ? modelData._icon:""
0045 visible: modelData._icon != undefined
0046 anchors.verticalCenter: parent.verticalCenter
0047 }
0048 Text {
0049 leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
0050 rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
0051
0052 text: control.text
0053 font: control.font
0054 color: control.enabled ? "#26282a" : "#bdbebf"
0055 width: parent.width
0056 wrapMode: Text.WordWrap
0057 anchors.verticalCenter: parent.verticalCenter
0058 visible: control.text
0059 horizontalAlignment: Text.AlignLeft
0060 verticalAlignment: Text.AlignVCenter
0061 }
0062 }
0063 //! [contentItem]
0064
0065 //! [background]
0066 background: Rectangle {
0067 implicitWidth: 100
0068 implicitHeight: 40
0069 visible: control.down || control.highlighted || control.visualFocus
0070 color: control.visualFocus ? (control.pressed ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#eeeeee")
0071 }
0072 //! [background]
0073 }