Albert
Loading...
Searching...
No Matches
icon.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Manuel Schneider
2// SPDX-License-Identifier: MIT
3
4#pragma once
5#include <albert/export.h>
6#include <memory>
7class QPainter;
8class QRect;
9class QSize;
10class QPixmap;
11class QString;
12
13namespace albert
14{
15
23class ALBERT_EXPORT Icon
24{
25public:
26
30 virtual ~Icon() = default;
31
35 virtual std::unique_ptr<Icon> clone() const = 0;
36
43 virtual QSize actualSize(const QSize &device_independent_size, double device_pixel_ratio);
44
50 virtual QPixmap pixmap(const QSize &device_independent_size, double device_pixel_ratio);
51
55 virtual void paint(QPainter *painter, const QRect &rect) = 0;
56
62 virtual bool isNull();
63
67 virtual QString toUrl() const = 0;
68
74 virtual QString cacheKey();
75
76};
77
78} // namespace albert
Abstract icon engine.
Definition icon.h:24
virtual void paint(QPainter *painter, const QRect &rect)=0
Uses the given painter to paint the icon into the rectangle rect.
virtual QPixmap pixmap(const QSize &device_independent_size, double device_pixel_ratio)
Returns a pixmap for the requested device_independent_size and device_pixel_ratio.
virtual QString cacheKey()
Returns the cache key of the icon.
virtual QString toUrl() const =0
Returns a URL representation of the icon.
virtual std::unique_ptr< Icon > clone() const =0
Returns a clone of this icon.
virtual QSize actualSize(const QSize &device_independent_size, double device_pixel_ratio)
Returns the device independent size of the available icon for the given device_independent_size and d...
virtual ~Icon()=default
Destructs the icon.
virtual bool isNull()
Returns true if the icon is valid; otherwise returns false.
Definition app.h:58