I'm because I found a possible solution to the problem of the icons and images.
Before exposure to you, I say that is strongly linked to the current versions of the Harbour compiler and the Qt library.
In fact, reading the documentation, I found the words "at present" especially on the Qt library and therefore binding.
Abstract:
pay close attention to the presence of qt.conf file in the directory of the executable program. Example:
plugins directory structure:[Paths]
plugins=../qt/plugins
Materials needed:...plugins\imageformats\qgif4.dll
...plugins\imageformats\qico4.dll
...plugins\imageformats\qjpeg4.dll
...plugins\imageformats\qmng4.dll
...plugins\imageformats\qsvg4.dll
...plugins\imageformats\qtiff4.dll
- Of course the library HMG4
- The full distribution of the Harbour compiler latest version, because (my solution) includes the use of compiler rcc.exe
Optional Material:
- The full distribution of the MinGW compiler
Note: If you have any problem at compile time, you may need the full distribution
As indicated in the documentation of QT website, to assign the icon to the program (Windows Explorer level) is still necessary to use the compiler windres.
A) How to assign the icon to the program (windows explorer level - probably, you already use a similar method):
A.1) Create a file <iconfilename>.rc:
Code: Select all
DEFAULT ICON <pathname/><icon-name>.ico
<iconfilename> is the name of the file .rc
<pathname/> is the directory where the icon file exist (optional, depending on your organization)
<icon-name> s the physical name of the image file
A.2) Compile the program with Harbour (the other options you already know):
B) How to create the resources fileHBMK2 %1 <iconfilename>.rc .....
Attention: if the source window.prg of the library HMG4, does NOT include the statement ":oQTObject:setWindowIcon()" you can not see the icon in the title bar of the window.
B.1) Create a file <resourcesfilename>.qrc (warning: .qrc):
Note:<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file alias="MYLOGO"><pathname\>l3w_logo.ico</file>
<file alias="L3W_IEXIT"><pathname\>exit.png</file>
<file alias="L3W_ISAVE"><pathname\>save.png</file>
</qresource>
</RCC>
<resourcesfilename> is the name of the file .qrc
<pathname/> is the directory where the images/icons files exists (optional, depending on your organization)
Warning: using the syntax alias="name", allows us to refer to the image with alias instead of the file name. Exactly like in the .rc file.
Just make sure that, using this syntax, we will have to use ":MYLOGO" instead of "MYLOGO"(see section C below)
Remember: alias IS case sensitive.
B.2) Compiling and creating a resource file <resourcesfilename>.rcc
Warning: the file. rcc must reside in the same directory of the executable program....\harbour\bin\rcc -binary -o <resourcesfilename>.rcc <resourcesfilename>.qrc
B.3) Code to be added at the beginning of your main program .prg
Code: Select all
#include "hmg.ch"
STATIC s_re1 <-------------
*.................................................................................
* main function
*.................................................................................
FUNCTION Main()
HBQT_ERRORSYS()
s_re1 := QResource() <-------------
s_re1:registerResource( "<resourcesfilename>.rcc" ) <-------------
Warning: <resourcesfilename>.rcc must be the same as B.2
B.4) Code to add when closing your main program (perhaps, in the event OnRelease of the main window)
Code: Select all
*.................................................................................
* main window OnRelease event
*.................................................................................
STATIC FUNCTION Win_OnRelease()
s_re1:unregisterResource( "<resourcesfilename>.rcc" )
RETURN NIL
B.5) Compile the program with Harbour (the other options you already know):
C) Use of images and icons in the programs .prg (examples)HBMK2 %1 <iconfilename>.rc .....
Warning: displaying the images is dependent on the library HMG4 handle the image correctly.
C.1) DEFINE WINDOW
Code: Select all
DEFINE WINDOW p000Win
ROW 0
COL 0
ICON ":MYLOGO"
.....
Code: Select all
MENUITEM "e&Xit" ACTION p000_Exit() IMAGE ":L3W_IEXIT"
Code: Select all
With Object oButton2 := Button():New()
...
:Picture := ':L3W_ISAVE'
...
Concluding remarks.
I'm not a Guru
I hope I was clear enough in the process of implementation
Unfortunately, the documentation for the world Xbase / Harbour is not very clear instead for the C programming
I don't know if this can be considered the only one solution: this is what I found after 4 weeks of errors
If you have any questions, I am at your disposal, but know that I consider myself a newbe. I'll do what I can
Warning:
I have read, about the contents of the file .rcc, which could be inserted into the executable at C compiler time as a file. cpp. I do not know how I can do. If anyone has any idea could tell me?
Cheers