what is the format to create it? Does we can make custom resources with it?
what is the format to create it? Does we can make custom resources with it?
what is the format to create it? Does we can make custom resources with it?
Do not cross post the same question in multiple places: that is bad form.
See: How can we create external Binary Resources in qt
Comment: This post was originally on a different thread before I merged both. Thus the post looks misplaces now... (Lykurg)
Last edited by Lykurg; 1st December 2011 at 09:13.
It is in the friendly manual under The Qt Resource System
A typical use of the resource system is to store images but you can store any data you like in the resource and interpret it any way you like when you read it. Resources are read only, so if the problem you are trying solve involves saving settings between runs then you want QSettings or your own file format, which has nothing to do with resources.
Yes.
You can, of course, use the Windows resource system on Windows.I want to make resources file something like that. Storing macro in .rc file and accessing it in program wherever used.
It's not clear what macros you are referring to. The macros that are associated with a Windows rc files are defined outside the rc file in a header file. Your C++ source code uses that header file to access those macro definitions. When you use those macros in conjunction with the Win32 API function that load reosurces, e.g. LoadCursor(), the Windows library fetch the relevant blob of the (compiled) resource data and return it. For example:
Qt Code:
// In resources.h #define IDC_TARGET 1000 // In resources.rc #include "resources.h" IDC_TARGET CURSOR "Target.cur" // In some cpp file #include "resources.h" ... LoadCursor(NULL, IDC_TARGET);To copy to clipboard, switch view to plain text mode
Nothing is stopping you from doing something similar for a Qt resource file:
or you can use the alias mechanism in the QRC file to provide a name that is independent of the included file name (so you can change the underlying file without changing your code):Qt Code:
// In resources.qrc <!DOCTYPE RCC><RCC version="1.0"> <qresource> <file>icons/target.png> </qresource> </RCC> // In resources.h #define IDC_TARGET ":/icons/target.png" // In some cpp file #include "resource.h" ...To copy to clipboard, switch view to plain text mode
Qt Code:
// In resources.qrc <!DOCTYPE RCC><RCC version="1.0"> <qresource> <file alias="IDC_TARGET">icons/target.png> </qresource> </RCC> // In some cpp fileTo copy to clipboard, switch view to plain text mode
Last edited by pratik041; 2nd December 2011 at 07:12. Reason: updated contents
Bookmarks