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

Provides icons from the current theme by their FDO name. More...

#include "themeimageprovider.h"

+ Inheritance diagram for LC::Util::ThemeImageProvider:
+ Collaboration diagram for LC::Util::ThemeImageProvider:

Public Member Functions

 ThemeImageProvider (const ICoreProxy_ptr &proxy)
 Creates the ThemeImageProvider with the given proxy. More...
 
QIcon GetIcon (const QStringList &path) override
 Returns an icon from the current iconset by its ID. More...
 
- Public Member Functions inherited from LC::Util::WidthIconProvider
 WidthIconProvider ()
 
QPixmap requestPixmap (const QString &id, QSize *size, const QSize &requestedSize)
 Reimplemented from QDeclarativeImageProvider::requestPixmap(). More...
 

Detailed Description

Provides icons from the current theme by their FDO name.

This class is used to provide images from the current LeechCraft icon theme to QML.

Its usage is as simple as following. First, you should add it to a QDeclarativeEngine in C++, for example:

QDeclarativeView *view; // some QML view
auto engine = view->engine ();
engine->addImageProvider ("ThemeIcons", new Util::ThemeImageProvider (proxy));

Here proxy is the plugin proxy passed to IInfo::Init() method of your plugin.

Then in QML:

Image {
source: "image://ThemeIcons/edit-delete" + / + width
}

Or if there is no need in scaling:

Image {
source: "image://ThemeIcons/edit-delete"
}

One could also use this with ActionButtons:

ActionButton {
actionIconURL: "image://ThemeIcons/edit-delete"
}

In this case there is no need to add width parameter manually, ActionButton will take care of it.

Definition at line 62 of file themeimageprovider.h.

Constructor & Destructor Documentation

◆ ThemeImageProvider()

LC::Util::ThemeImageProvider::ThemeImageProvider ( const ICoreProxy_ptr proxy)

Creates the ThemeImageProvider with the given proxy.

Parameters
[in]proxyThe proxy object passed to IInfo::Init() of your plugin.

Definition at line 21 of file themeimageprovider.cpp.

Member Function Documentation

◆ GetIcon()

QIcon LC::Util::ThemeImageProvider::GetIcon ( const QStringList &  path)
overridevirtual

Returns an icon from the current iconset by its ID.

Reimplemented from WidthIconProvider::GetIcon().

Parameters
[in]pathThe icon path, like QStringList { "edit-delete" }.
Returns
The icon from the current iconset at the given path, or an empty icon otherwise.

Implements LC::Util::WidthIconProvider.

Definition at line 26 of file themeimageprovider.cpp.


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