KDWinUtils
Helper library for MFC to Qt migration
|
The KResourceHelper class is used to access resources. More...
#include <kresourcehelper.h>
Classes | |
struct | StringForTranslation |
Public Types | |
using | AssetMap = std::unordered_map<int, const char *> |
using | TranslationMap = std::unordered_map<int, StringForTranslation> |
Public Member Functions | |
QString | asset (int id) const |
bool | hasAsset (int id) const |
bool | hasString (int id) const |
KResourceHelper (TranslationMap strings, AssetMap assets) | |
QImage | loadImage (int id) const |
QPixmap | loadPixmap (int id) const |
QString | string (int id) const |
virtual | ~KResourceHelper () |
Protected Attributes | |
AssetMap | m_assets |
TranslationMap | m_strings |
The KResourceHelper class is used to access resources.
It stores a dictionary of all strings and assets resources, and give access to them. An instance of this class is usually created per library and generated via a script based on the RC file.
using KResourceHelper::AssetMap = std::unordered_map<int, const char *> |
using KResourceHelper::TranslationMap = std::unordered_map<int, StringForTranslation> |
KResourceHelper::KResourceHelper | ( | TranslationMap | strings, |
AssetMap | assets ) |
|
virtual |
QString KResourceHelper::asset | ( | int | id | ) | const |
Returns the qrc string for loading the asset of the given resource id
bool KResourceHelper::hasAsset | ( | int | id | ) | const |
Returns true of the asset exists
bool KResourceHelper::hasString | ( | int | id | ) | const |
Returns true of the string exists
QImage KResourceHelper::loadImage | ( | int | id | ) | const |
Returns an image for the given resource id
QPixmap KResourceHelper::loadPixmap | ( | int | id | ) | const |
Returns a pixmap for the given resource id
QString KResourceHelper::string | ( | int | id | ) | const |
Returns the string for the given resource id
|
protected |
|
protected |