Logo    
KDWinUtils
Helper library for MFC to Qt migration
Loading...
Searching...
No Matches
kresourcehelper.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** This file is part of KDWinutils, KDAB's MFC to Qt migration tool.
4**
5** Copyright (C) 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6** All rights reserved.
7**
8** This file is intended solely for use by the migration tools and services
9** provided by Klarälvdalens Datakonsult AB.
10**
11** Any other use or distribution of this software that is not otherwise agreed
12** upon in writing and signed by an authorized representative of Klarälvdalens
13** Datakonsult AB, KDAB (USA) LLC, KDAB (Deutschland) GmbH & Co. K.G.,
14** KDAB (France) SAS, KDAB (UK), Ltd., or any future subsidiary of Klarälvdalens
15** Datakonsult AB is hereby prohibited.
16**
17** Contact info@kdab.com if any conditions stated above are unclear to you.
18**
19****************************************************************************/
20
21#pragma once
22
24
25#include <QCoreApplication>
26#include <QImage>
27#include <QPixmap>
28#include <QString>
29#include <unordered_map>
30
32
40{
41 Q_DECLARE_TR_FUNCTIONS(KResourceHelper)
42
43public:
45 {
46 const char *source;
47 const char *comment;
48 };
49 using TranslationMap = std::unordered_map<int, StringForTranslation>;
50 using AssetMap = std::unordered_map<int, const char *>;
51
54
56 QString string(int id) const;
57
59 QString asset(int id) const;
61 QPixmap loadPixmap(int id) const;
63 QImage loadImage(int id) const;
64
66 bool hasString(int id) const;
68 bool hasAsset(int id) const;
69
70protected:
73};
74
The KResourceHelper class is used to access resources.
Definition kresourcehelper.h:40
bool hasString(int id) const
virtual ~KResourceHelper()
QString asset(int id) const
QImage loadImage(int id) const
std::unordered_map< int, StringForTranslation > TranslationMap
Definition kresourcehelper.h:49
KResourceHelper(TranslationMap strings, AssetMap assets)
QPixmap loadPixmap(int id) const
TranslationMap m_strings
Definition kresourcehelper.h:71
std::unordered_map< int, const char * > AssetMap
Definition kresourcehelper.h:50
QString string(int id) const
AssetMap m_assets
Definition kresourcehelper.h:72
bool hasAsset(int id) const
#define KDWINUTILS_EXPORT
Definition kdwinutils_export.h:31
#define KDWINUTILS_BEGIN_NAMESPACE
Definition kdwinutils_global.h:27
#define KDWINUTILS_END_NAMESPACE
Definition kdwinutils_global.h:28
Definition kresourcehelper.h:45
const char * comment
Definition kresourcehelper.h:47
const char * source
Definition kresourcehelper.h:46