Warning, /plasma/discover/discover/qml/ConditionalObject.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2018 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *
0004  *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 import QtQuick 2.1
0008 
0009 QtObject
0010 {
0011     id: root
0012 
0013     property Component componentTrue
0014     property Component componentFalse
0015     property bool condition
0016 
0017     onConditionChanged: {
0018         if (object)
0019             object.destroy(100)
0020 
0021         var component = (condition ? componentTrue : componentFalse)
0022         object = component ? component.createObject(root) : null
0023     }
0024 
0025     property QtObject object
0026 }