API Documentation
Loading...
Searching...
No Matches
SVGIconManager.h
Go to the documentation of this file.
1#pragma once
2#include "DLLInfo.h"
7#include <QTransform>
8#include <QIconEngine>
9class QSvgRenderer;
10namespace NDEVR
11{
12 /**--------------------------------------------------------------------------------------------------
13 \brief Stores a specific renderer and transform for SVG rendering.
14 **/
16 {
17 IconEngineItem(const QTransform& transform, QSvgRenderer* render)
19 , renderer(render)
20 {}
21 QTransform transform;
22 QSvgRenderer* renderer;
23 };
24 /**--------------------------------------------------------------------------------------------------
25 \brief A QIconEngine used to render SVG icons
26 **/
27 class NDEVR_IMAGES_API NDEVRSVGIconEngine : public QIconEngine
28 {
29 public:
30 NDEVRSVGIconEngine(const String& icon, const IconThemeSettings& theme, QIcon::Mode mode = QIcon::Mode::Normal);
31 NDEVRSVGIconEngine(const Buffer<IconEngineItem>& renderers, const String& icon, const IconThemeSettings& theme, QIcon::Mode mode = QIcon::Mode::Normal);
33 //void setIconTheme(const IconThemeSettings theme);
34 virtual void paint(QPainter* painter, const QRect& rect, QIcon::Mode mode, QIcon::State state) override;
35 QSize actualSize(const QSize& size, QIcon::Mode mode, QIcon::State state) override;
36 virtual QPixmap pixmap(const QSize& size, QIcon::Mode mode, QIcon::State state) override;
37 QSize defaultSize();
38 virtual QIconEngine* clone(void) const override;
39
40 protected:
41 void createSVGRenderer(const QSize& size);
42 public:
47 QIcon::Mode m_override_mode;
48 mutable QSize m_default_size;
49 };
50 /**--------------------------------------------------------------------------------------------------
51 \brief Allows the NDEVR engine to process and display SVG icons within the UI.
52 **/
54 {
55 public:
57 QIcon createIcon(const String& icon, const IconThemeSettings& theme, QIcon::Mode mode = QIcon::Mode::Normal) final override;
58 bool canProcess(const String& icon, const IconThemeSettings& theme, QIcon::Mode mode) const final override;
59 private:
60 UUID m_id;
61 };
62}
#define NDEVR_IMAGES_API
Definition DLLInfo.h:56
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
Used to render any icons or fetch any pixmaps within the software. More rendering engines can be adde...
Definition QTIconManager.h:81
A QIconEngine used to render SVG icons.
Definition SVGIconManager.h:28
IconThemeSettings m_icon_theme
Definition SVGIconManager.h:45
QIcon::Mode m_override_mode
Definition SVGIconManager.h:47
virtual QIconEngine * clone(void) const override
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override
QSize m_default_size
Definition SVGIconManager.h:48
virtual void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override
String m_icon
Definition SVGIconManager.h:46
virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override
void createSVGRenderer(const QSize &size)
Dictionary< QIcon::Mode, QPixmap > m_cached_pixmap
Definition SVGIconManager.h:44
Buffer< IconEngineItem > m_renderers
Definition SVGIconManager.h:43
NDEVRSVGIconEngine(const Buffer< IconEngineItem > &renderers, const String &icon, const IconThemeSettings &theme, QIcon::Mode mode=QIcon::Mode::Normal)
NDEVRSVGIconEngine(const String &icon, const IconThemeSettings &theme, QIcon::Mode mode=QIcon::Mode::Normal)
Allows the NDEVR engine to process and display SVG icons within the UI.
Definition SVGIconManager.h:54
QIcon createIcon(const String &icon, const IconThemeSettings &theme, QIcon::Mode mode=QIcon::Mode::Normal) final override
bool canProcess(const String &icon, const IconThemeSettings &theme, QIcon::Mode mode) const final override
The core String class for the NDEVR API.
Definition String.h:69
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
Definition ACIColor.h:37
Stores a specific renderer and transform for SVG rendering.
Definition SVGIconManager.h:16
QTransform transform
Definition SVGIconManager.h:21
IconEngineItem(const QTransform &transform, QSvgRenderer *render)
Definition SVGIconManager.h:17
QSvgRenderer * renderer
Definition SVGIconManager.h:22
Stores information for how to draw icons, when supported.
Definition QTIconManager.h:59