Warning, /system/mycroft-gui/import/qml/ScrollableDelegate.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright 2018 by Marco Martin <mart@kde.org>
0003 * Copyright 2018 David Edmundson <davidedmundson@kde.org>
0004 *
0005 * Licensed under the Apache License, Version 2.0 (the "License");
0006 * you may not use this file except in compliance with the License.
0007 * You may obtain a copy of the License at
0008 *
0009 * http://www.apache.org/licenses/LICENSE-2.0
0010 *
0011 * Unless required by applicable law or agreed to in writing, software
0012 * distributed under the License is distributed on an "AS IS" BASIS,
0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014 * See the License for the specific language governing permissions and
0015 * limitations under the License.
0016 *
0017 */
0018
0019 import QtQuick 2.15
0020 import QtQuick.Controls 2.15 as Controls
0021 import org.kde.kirigami 2.19 as Kirigami
0022 import Mycroft 1.0 as Mycroft
0023
0024 //TODO: this muct become a Delegate subclass
0025 Delegate {
0026 id: control
0027
0028 //this to make all items children of the scrollview item so everything will have paddings automagically
0029 default property alias data: main.contentData
0030
0031 readonly property bool userInteracting: main.contentItem.hasOwnProperty("moving") && main.contentItem.moving
0032
0033 leftPadding: (main.mainItem.hasOwnProperty("contentHeight") ? 0 : Kirigami.Units.largeSpacing) + (typeof view !== "undefined" && view() ? view().leftPadding : 0)
0034 topPadding: (main.mainItem.hasOwnProperty("contentHeight") ? 0 : Kirigami.Units.largeSpacing) + (typeof view !== "undefined" && view() ? view().topPadding : 0)
0035 rightPadding: (main.mainItem.hasOwnProperty("contentHeight") ? 0 : Kirigami.Units.largeSpacing) + (typeof view !== "undefined" && view() ? view().rightPadding : 0)
0036 bottomPadding: (main.mainItem.hasOwnProperty("contentHeight") ? 0 : Kirigami.Units.largeSpacing) + (typeof view !== "undefined" && view() ? view().bottomPadding : 0)
0037
0038 Component.onCompleted: main.contentItem.clip = false
0039 //clip the delegate and not the scrollview because we do want items to bleed over margins
0040 clip: true
0041 contentItem: Controls.ScrollView {
0042 id: main
0043 contentWidth: width
0044 clip: false
0045 //if mainItem is == contentItem then the main item is a flickable, otherwise is auto created internally
0046 property Item mainItem: contentChildren[contentChildren.length-1]
0047
0048 contentHeight: mainItem.hasOwnProperty("contentHeight") ? mainItem.contentHeight : mainItem.height
0049 }
0050 }