KDEGames

kgamerendereditem.h
1 /*
2  SPDX-FileCopyrightText: 2010 Stefan Majewsky <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-only
5 */
6 
7 #ifndef KGAMERENDEREDITEM_H
8 #define KGAMERENDEREDITEM_H
9 
10 // own
11 #include "kgamerendererclient.h"
12 #include <libkdegames_export.h>
13 // Qt
14 #include <QObject>
15 #include <QGraphicsItem>
16 // Std
17 #include <memory>
18 
19 class KGameRenderedItemPrivate;
20 
21 /**
22  * @class KGameRenderedItem kgamerendereditem.h <KGameRenderedItem>
23  * @since 4.6
24  * @short A QGraphicsPixmapItem which reacts to theme changes automatically.
25  *
26  * This class is a QGraphicsPixmapItem which retrieves its pixmap from a
27  * KGameRenderer, and updates it automatically when the KGameRenderer changes
28  * the theme.
29  */
30 class KDEGAMES_EXPORT KGameRenderedItem : public QGraphicsPixmapItem, public KGameRendererClient
31 {
32  public:
33  ///Creates a new KGameRenderedItem which renders the sprite with the
34  ///given @a spriteKey as provided by the given @a renderer.
35  KGameRenderedItem(KGameRenderer* renderer, const QString& spriteKey, QGraphicsItem* parent = nullptr);
36  ~KGameRenderedItem() override;
37  protected:
38  void receivePixmap(const QPixmap& pixmap) override;
39  private:
40  friend class KGameRenderedItemPrivate;
41  std::unique_ptr<KGameRenderedItemPrivate> const d;
42 };
43 
44 #endif // KGAMERENDEREDITEM_H
virtual void receivePixmap(const QPixmap &pixmap)=0
This method is called when the KGameRenderer has provided a new pixmap for this client (esp...
Cache-enabled rendering of SVG themes.
Definition: kgamerenderer.h:86
An object that receives pixmaps from a KGameRenderer.
A QGraphicsPixmapItem which reacts to theme changes automatically.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Dec 7 2021 22:34:14 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.