/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ import QtQuick 2.0 import QtQml 2.12 import QtQuick.Controls 2.5 import QtQuick.Layouts 1.12 import AppControls2 1.0 as AppControls2 import org.ukui.menu.core 1.0 Item { property string title: "" MouseArea { id: appListArea hoverEnabled: true anchors.fill: parent RowLayout { anchors.fill: parent spacing: 0 ListView { id: appListView spacing: 4 Layout.fillHeight: true Layout.fillWidth: true ScrollBar.vertical: appListScrollBar model: modelManager.getAppModel() delegate: Component { Loader { width: ListView.view ? ListView.view.width : 0 height: 40 property int index: model.index property int type: model.type property string name: model.name property string icon: model.icon sourceComponent: { if (type === DataType.Normal) { return appItem; } if (type === DataType.Folder) { return folderItem; } if (type === DataType.Label) { return labelItem; } } } } } AppControls2.ScrollBar { id: appListScrollBar Layout.fillHeight: true Layout.preferredWidth: 14 visible: appListArea.containsMouse } } } Component { id: appItem AppControls2.AppItem {} } Component { id: labelItem AppControls2.LabelItem {} } Component { id: folderItem AppControls2.FolderItem {} } }