Warning, /games/libkdegames/src/qml/qml/KGameItem.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2012 Viranch Mehta <viranch.mehta@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.3
0008 
0009 Image {
0010     // frontend sprite: shown after a rendered sprite is received
0011     id: frontend
0012 
0013     property variant provider
0014     property string spriteKey
0015 
0016     smooth: true
0017 
0018     Image {
0019         // backend sprite: triggers requests for new sprite
0020 
0021         property alias prov: frontend.provider
0022         property string provName: prov==undefined ? "" : prov.name
0023         property string theme: prov==undefined ? "" : prov.currentThemeName
0024         property alias key: frontend.spriteKey
0025         property string size: Math.round(width)+"x"+Math.round(height)
0026         property string sourceUrl: "image://"+provName+"/"+theme+"/"+key+"/"+size
0027         source: prov==undefined || key=="" || width*height==0 ? "" : sourceUrl
0028 
0029         anchors.fill: parent
0030         smooth: parent.smooth
0031         cache: parent.cache
0032         asynchronous: true
0033         visible: false
0034 
0035         onStatusChanged: { // loads the sprite received from ImageProvider
0036             if (status == Image.Ready) parent.source = source;
0037         }
0038         onSourceChanged: { // loads sprite from cache as status does not change in this case
0039             if (status == Image.Ready) parent.source = source;
0040         }
0041     }
0042 }