LeechCraft  0.6.70-10870-g558588d6ec
Modular cross-platform feature rich live environment.
LeechCraft::Util::WidthIconProvider Class Referenceabstract

Provides scalable icons to QML. More...

#include "widthiconprovider.h"

+ Inheritance diagram for LeechCraft::Util::WidthIconProvider:
+ Collaboration diagram for LeechCraft::Util::WidthIconProvider:

Public Member Functions

 WidthIconProvider ()
 
QPixmap requestPixmap (const QString &id, QSize *size, const QSize &requestedSize)
 Reimplemented from QDeclarativeImageProvider::requestPixmap(). More...
 
virtual QIcon GetIcon (const QStringList &path)=0
 Implement this method to return a proper QIcon for path. More...
 

Detailed Description

Provides scalable icons to QML.

This class is used to provide pixmaps generated from QIcons to QML. It supports generating different pixmaps for different source sizes. For that, the last component of the URL in the source property of a QML Image should correspond to the current width, like this:

Image {
source: someIconString + '/' + width
// ...
}

The subclasses should implement the GetIcon() pure virtual function, which should return a QIcon for a given path, where path is a QStringList obtained by breaking the URL path at '/' and leaving the width component.

Please also see the documentation for QIcon::pixmap() regarding upscaling.

See also
ThemeImageProvider

Definition at line 68 of file widthiconprovider.h.

Constructor & Destructor Documentation

◆ WidthIconProvider()

LeechCraft::Util::WidthIconProvider::WidthIconProvider ( )

Definition at line 37 of file widthiconprovider.cpp.

Member Function Documentation

◆ GetIcon()

virtual QIcon LeechCraft::Util::WidthIconProvider::GetIcon ( const QStringList &  path)
pure virtual

Implement this method to return a proper QIcon for path.

See this class documentation for more information.

Parameters
[in]pathThe icon path, a list obtained by breaking the URL request path at '/'.
Returns
QIcon for the path, or an empty QIcon.

Implemented in LeechCraft::Util::ThemeImageProvider, and LeechCraft::Util::SettableIconProvider.

Referenced by requestPixmap().

+ Here is the caller graph for this function:

◆ requestPixmap()

QPixmap LeechCraft::Util::WidthIconProvider::requestPixmap ( const QString &  id,
QSize *  size,
const QSize &  requestedSize 
)

Reimplemented from QDeclarativeImageProvider::requestPixmap().

Parameters
[in]idThe image ID.
[in]sizeIf non-null, will be set to the real size of the generated image.
[in]requestedSizeThe requested image size.

Definition at line 42 of file widthiconprovider.cpp.

References GetIcon().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: