LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
LC::Util::WidthIconProvider Class Referenceabstract

Provides scalable icons to QML. More...

#include "widthiconprovider.h"

+ Inheritance diagram for LC::Util::WidthIconProvider:
+ Collaboration diagram for LC::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 45 of file widthiconprovider.h.

Constructor & Destructor Documentation

◆ WidthIconProvider()

LC::Util::WidthIconProvider::WidthIconProvider ( )

Definition at line 20 of file widthiconprovider.cpp.

Member Function Documentation

◆ GetIcon()

virtual QIcon LC::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 LC::Util::ThemeImageProvider, and LC::Util::SettableIconProvider.

◆ requestPixmap()

QPixmap LC::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 25 of file widthiconprovider.cpp.


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