Logo    
KDWinUtils
Helper library for MFC to Qt migration
Loading...
Searching...
No Matches
KResourceHelper Class Reference

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
 

Detailed Description

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.

Member Typedef Documentation

◆ AssetMap

using KResourceHelper::AssetMap = std::unordered_map<int, const char *>

◆ TranslationMap

using KResourceHelper::TranslationMap = std::unordered_map<int, StringForTranslation>

Constructor & Destructor Documentation

◆ KResourceHelper()

KResourceHelper::KResourceHelper ( TranslationMap strings,
AssetMap assets )

◆ ~KResourceHelper()

virtual KResourceHelper::~KResourceHelper ( )
virtual

Member Function Documentation

◆ asset()

QString KResourceHelper::asset ( int id) const

Returns the qrc string for loading the asset of the given resource id

◆ hasAsset()

bool KResourceHelper::hasAsset ( int id) const

Returns true of the asset exists

◆ hasString()

bool KResourceHelper::hasString ( int id) const

Returns true of the string exists

◆ loadImage()

QImage KResourceHelper::loadImage ( int id) const

Returns an image for the given resource id

◆ loadPixmap()

QPixmap KResourceHelper::loadPixmap ( int id) const

Returns a pixmap for the given resource id

◆ string()

QString KResourceHelper::string ( int id) const

Returns the string for the given resource id

Member Data Documentation

◆ m_assets

AssetMap KResourceHelper::m_assets
protected

◆ m_strings

TranslationMap KResourceHelper::m_strings
protected

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