|
Albert
|
#include <albert/icon.h>
Abstract icon engine.
Public Member Functions | |
| virtual | ~Icon () |
| Destructs 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 device_pixel_ratio. | |
| 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 void | paint (QPainter *painter, const QRect &rect)=0 |
| Uses the given painter to paint the icon into the rectangle rect. | |
| virtual bool | isNull () |
Returns true if the icon is valid; otherwise returns false. | |
| virtual QString | toUrl () const =0 |
| Returns a URL representation of the icon. | |
| virtual QString | cacheKey () |
| Returns the cache key of the icon. | |
Static Public Member Functions | |
| static QIcon | qIcon (std::unique_ptr< albert::Icon > icon) |
Returns a QIcon using icon as icon engine. | |
| static std::unique_ptr< Icon > | iconFromUrl (const QString &url) |
| Returns a built-in icon for the given url. | |
| static std::unique_ptr< Icon > | iconFromUrls (const QStringList &urls) |
| Returns a built-in icon for the given urls. | |
Image icon | |
| static std::unique_ptr< Icon > | image (const QString &path) |
| Returns an icon from an image file at path. | |
| static std::unique_ptr< Icon > | image (const std::filesystem::path &path) |
| Returns an icon from an image file at path. | |
File type icon | |
| static std::unique_ptr< Icon > | fileType (const QString &path) |
| Returns an icon representing the file type of the file at path. | |
| static std::unique_ptr< Icon > | fileType (const std::filesystem::path &path) |
| Returns an icon representing the file type of the file at path. | |
Theme icon (<a href="https://specifications.freedesktop.org/icon-theme/latest/" >XDG icon lookup</a>) | |
| static std::unique_ptr< Icon > | theme (const QString &icon_name) |
| Returns an icon from the current icon theme with the given icon_name. | |
Grapheme icon | |
| static QBrush | graphemeDefaultBrush () |
| Returns the window text color of the current application palette. | |
| static std::unique_ptr< Icon > | grapheme (const QString &grapheme, double scalar=1.0) |
| Returns an icon rendering the given grapheme with graphemeDefaultBrush, scaled by scalar. | |
| static std::unique_ptr< Icon > | grapheme (const QString &grapheme, double scalar, const QBrush &brush) |
| Returns an icon rendering the given grapheme, scaled by scalar and colored with brush. | |
Iconified icon | |
| static const QBrush & | iconifiedDefaultBackgroundBrush () |
| Returns the default background brush (a top down gradient from white to some darker white). | |
| static const QBrush & | iconifiedDefaultBorderBrush () |
| Returns the default border color (a gradient slightly darker than the default background). | |
| static std::unique_ptr< Icon > | iconified (std::unique_ptr< Icon > icon, const QBrush &background_brush=iconifiedDefaultBackgroundBrush(), double border_radius=1.0, int border_width=1, const QBrush &border_color=iconifiedDefaultBorderBrush()) |
| Returns iconified icon. | |
Composed icon | |
| static std::unique_ptr< Icon > | composed (std::unique_ptr< Icon > icon1, std::unique_ptr< Icon > icon2, double size1=0.7, double size2=0.7, double x1=0.0, double y1=0.0, double x2=1.0, double y2=1.0) |
| Returns a composed icon from icon1 and icon2. | |
Standard icon (QStyle standard pixmap) | |
This enum describes the available standard icons. See Qt documentation for more details. | |
| enum | StandardIconType |
| static std::unique_ptr< Icon > | standard (StandardIconType type) |
| Returns a standard icon for the given type. | |
|
virtual |
Returns the device independent size of the available icon for the given device_independent_size and device_pixel_ratio.
The base implementations returns device_independent_size.
|
virtual |
Returns the cache key of the icon.
The base implementation calls toUrl. Reimplement to get faster lookups.
|
static |
Returns a composed icon from icon1 and icon2.
size1 and size2 specify the relative sizes (0.0 - 1.0) of the icons. x1, y1, x2, and y2 specify the relative positions (0.0 - 1.0, 0.5 is centered) of the icons.
|
static |
Returns an icon representing the file type of the file at path.
|
static |
Returns iconified icon.
i.e. drawn in a colored rounded rectangle with a border.
color specifies the background color, border_width the border width in device independent pixels, border_radius the relative border radius (0.0 - 1.0), and border_color the border color.
|
static |
Returns an icon from an image file at path.
|
virtual |
Returns true if the icon is valid; otherwise returns false.
The base implementation returns false.
|
virtual |
Returns a pixmap for the requested device_independent_size and device_pixel_ratio.
The base implementation creates a transparent pixmap of actualSize and calls paint on it.