/*SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>SPDX-License-Identifier: GPL-2.0-or-later*/import QtQuick 2.12import QtQuick.Controls 2.12 as QQC2import org.kde.kirigami 2.7 as KirigamiQQC2.ComboBox {id: comboBoxproperty string labelproperty var componentKirigami.FormData.label: labelmodel: component.applicationstextRole: "name"currentIndex: component.indexonActivated: component.select(currentIndex, true)delegate: QQC2.ItemDelegate {width: comboBox.popup.widthtext: modelData[comboBox.textRole]highlighted: comboBox.highlightedIndex == indexicon.name: modelData.icon}// HACK QQC2 doesn't support icons, so we just tamper with the desktop style ComboBox's backgroundComponent.onCompleted: {if (!background || !background.hasOwnProperty("properties")) {//not a KQuickStyleItemreturn;}var props = background.properties || {};background.properties = Qt.binding(function() {var newProps = props;newProps.currentIcon = component.applications[currentIndex]["icon"];newProps.iconColor = Kirigami.Theme.textColor;return newProps;});}}