QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskGraphicProvider.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_GRAPHIC_PROVIDER_H
7#define QSK_GRAPHIC_PROVIDER_H
8
9#include "QskGlobal.h"
10
11#include <qobject.h>
12#include <memory>
13
14class QskGraphic;
15class QUrl;
16
17class QSK_EXPORT QskGraphicProvider : public QObject
18{
19 Q_OBJECT
20
21 Q_PROPERTY( int cacheSize READ cacheSize WRITE setCacheSize )
22
23 public:
24 QskGraphicProvider( QObject* parent = nullptr );
25 ~QskGraphicProvider() override;
26
27 void setCacheSize( int );
28 int cacheSize() const;
29
30 void clearCache();
31
32 const QskGraphic* requestGraphic( const QString& id ) const;
33
34 protected:
35 virtual const QskGraphic* loadGraphic( const QString& id ) const = 0;
36
37 class PrivateData;
38 std::unique_ptr< PrivateData > m_data;
39};
40
41namespace Qsk
42{
43 QSK_EXPORT void addGraphicProvider( const QString& providerId, QskGraphicProvider* );
44 QSK_EXPORT QskGraphicProvider* graphicProvider( const QString& providerId );
45
46 QSK_EXPORT QskGraphic loadGraphic( const QUrl& url );
47 QSK_EXPORT QskGraphic loadGraphic( const char* source );
48}
49
50#endif
A paint device for scalable graphics.
Definition QskGraphic.h:28
Global definitions.