Warning, /multimedia/elisa/src/qml/ViewSelector.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2016 (c) Matthieu Gallien <matthieu_gallien@yahoo.fr> 0003 0004 SPDX-License-Identifier: LGPL-3.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Controls 2.4 0009 import QtQml.Models 2.2 0010 import org.kde.kirigami 2.10 as Kirigami 0011 import org.kde.elisa 1.0 0012 0013 ScrollView { 0014 id: scrollView 0015 0016 property alias model: viewModeView.model 0017 0018 property alias viewIndex: viewModeView.currentIndex 0019 readonly property int wideWidth: Kirigami.Units.gridUnit * 12 0020 readonly property int iconsOnlyWidth: Kirigami.Units.iconSizes.smallMedium + 2 * Kirigami.Units.largeSpacing + (ScrollBar.vertical.visible ? ScrollBar.vertical.implicitWidth : 0) 0021 0022 signal switchView(int viewIndex) 0023 0024 implicitWidth: mainWindow.width > elisaTheme.viewSelectorSmallSizeThreshold ? wideWidth : iconsOnlyWidth 0025 Behavior on implicitWidth { 0026 NumberAnimation { 0027 easing.type: Easing.InOutQuad 0028 duration: Kirigami.Units.longDuration 0029 } 0030 } 0031 0032 // HACK: workaround for https://bugreports.qt.io/browse/QTBUG-83890 0033 ScrollBar.horizontal.policy: ScrollBar.AlwaysOff 0034 0035 contentItem: ListView { 0036 id: viewModeView 0037 0038 reuseItems: true 0039 clip: true 0040 focus: true 0041 activeFocusOnTab: true 0042 keyNavigationEnabled: true 0043 interactive: true 0044 0045 delegate: ItemDelegate { 0046 width: viewModeView.width 0047 0048 icon.source: model.image 0049 text: model.display 0050 highlighted: ListView.isCurrentItem 0051 0052 onClicked: { 0053 switchView(index) 0054 forceActiveFocus() 0055 } 0056 } 0057 0058 section.property: 'entryCategory' 0059 section.delegate: Loader { 0060 active: section !== "default" && opacity > 0 0061 height: item ? item.implicitHeight : 0 0062 sourceComponent: Kirigami.ListSectionHeader { 0063 label: section 0064 width: viewModeView.width 0065 } 0066 opacity: scrollView.implicitWidth === wideWidth ? 1 : 0 0067 Behavior on opacity { 0068 NumberAnimation { 0069 easing.type: Easing.InOutQuad 0070 duration: Kirigami.Units.longDuration 0071 } 0072 } 0073 } 0074 } 0075 }