KDEGames

KgItem.qml
1 /*
2  SPDX-FileCopyrightText: 2012 Viranch Mehta <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 import QtQuick 2.3
8 
9 Image {
10  // frontend sprite: shown after a rendered sprite is received
11  id: frontend
12 
13  property variant provider
14  property string spriteKey
15 
16  smooth: true
17 
18  Image {
19  // backend sprite: triggers requests for new sprite
20 
21  property alias prov: frontend.provider
22  property string provName: prov==undefined ? "" : prov.name
23  property string theme: prov==undefined ? "" : prov.currentThemeName
24  property alias key: frontend.spriteKey
25  property string size: Math.round(width)+"x"+Math.round(height)
26  property string sourceUrl: "image://"+provName+"/"+theme+"/"+key+"/"+size
27  source: prov==undefined || key=="" || width*height==0 ? "" : sourceUrl
28 
29  anchors.fill: parent
30  smooth: parent.smooth
31  cache: parent.cache
32  asynchronous: true
33  visible: false
34 
35  onStatusChanged: { // loads the sprite received from ImageProvider
36  if (status == Image.Ready) parent.source = source;
37  }
38  onSourceChanged: { // loads sprite from cache as status does not change in this case
39  if (status == Image.Ready) parent.source = source;
40  }
41  }
42 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Dec 7 2021 22:34:15 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.