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 "kdegames_export.h"
12 #include "kgamerendererclient.h"
13 // Qt
14 #include <QGraphicsItem>
15 // Std
16 #include <memory>
17 
18 class KGameRenderedItemPrivate;
19 
20 /**
21  * @class KGameRenderedItem kgamerendereditem.h <KGameRenderedItem>
22  * @short A QGraphicsPixmapItem which reacts to theme changes automatically.
23  *
24  * This class is a QGraphicsPixmapItem which retrieves its pixmap from a
25  * KGameRenderer, and updates it automatically when the KGameRenderer changes
26  * the theme.
27  * @since 4.6
28  */
29 class KDEGAMES_EXPORT KGameRenderedItem : public QGraphicsPixmapItem, public KGameRendererClient
30 {
31 public:
32  /// Creates a new KGameRenderedItem which renders the sprite with the
33  /// given @a spriteKey as provided by the given @a renderer.
34  KGameRenderedItem(KGameRenderer *renderer, const QString &spriteKey, QGraphicsItem *parent = nullptr);
35  ~KGameRenderedItem() override;
36 
37 protected:
38  void receivePixmap(const QPixmap &pixmap) override;
39 
40 private:
41  friend class KGameRenderedItemPrivate;
42  std::unique_ptr<KGameRenderedItemPrivate> const d_ptr;
43  Q_DECLARE_PRIVATE(KGameRenderedItem)
44 };
45 
46 #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.
An object that receives pixmaps from a KGameRenderer.
A QGraphicsPixmapItem which reacts to theme changes automatically.
Cache-enabled rendering of SVG themes.
Definition: kgamerenderer.h:83
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Dec 11 2023 04:06:22 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.