KDEGames

kgamerendereditem.h
1/*
2 SPDX-FileCopyrightText: 2010 Stefan Majewsky <majewsky@gmx.net>
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
18class 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 */
29class KDEGAMES_EXPORT KGameRenderedItem : public QGraphicsPixmapItem, public KGameRendererClient
30{
31public:
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
37protected:
38 void receivePixmap(const QPixmap &pixmap) override;
39
40private:
41 friend class KGameRenderedItemPrivate;
42 std::unique_ptr<KGameRenderedItemPrivate> const d_ptr;
43 Q_DECLARE_PRIVATE(KGameRenderedItem)
44};
45
46#endif // KGAMERENDEREDITEM_H
A QGraphicsPixmapItem which reacts to theme changes automatically.
An object that receives pixmaps from a KGameRenderer.
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.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:16:50 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.