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
17class ALBERT_EXPORT Icon
18{
19public:
20
22 virtual ~Icon() = default;
23
25 virtual std::unique_ptr<Icon> clone() const = 0;
26
30 virtual QSize actualSize(const QSize &device_independent_size, double device_pixel_ratio);
31
34 virtual QPixmap pixmap(const QSize &device_independent_size, double device_pixel_ratio);
35
37 virtual void paint(QPainter *painter, const QRect &rect) = 0;
38
41 virtual bool isNull();
42
44 virtual QString toUrl() const = 0;
45
48 virtual QString cacheKey();
49
50};
51
52} // namespace albert
Abstract icon engine.
Definition icon.h:18
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 icon available 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.
Albert core interface namespace.
Definition albert.h:14