Hi Pritpal,
we can add embedded resource[s] using <thename>.qrc file and we know must be registered before use with "hbqtres_" + <thename> function.
With embedded resources we can add file (eg. text, translations, etc).
Following example on internet -related with .qss file- I start using this (adapted) code
LOCAL oFile
LOCAL cStyleSheet
LOCAL oString
oFile := QFile()
oFile:setFileName( <name_of_the_file> )
IF oFile:exists() .AND. oFile:open( QIODevice_ReadOnly )
oString := QLatin1String( oFile:readAll() )
cStyleSheet := oString:latin1()
oFile:close()
QApplication():setStyleSheet( cStyleSheet )
ENDIF
But it fails related with QLatin1String(...) because HbQt doesn't accept QByteArray as argument (see readAll() function )
As a workaround, I have used
oB := oFile:readAll()
cStyleSheet := oB:data()
AFAIK using oB:data() I can get hard data and they can be (give me a cent) encoded or not;
as example I read your demovisualizer.prg function __appLoadResourceAsBase64String
So the question: what is the best (or right) way to read/extract "data" from embedded resource file assumed
its content is text (IOW I'm thinking also to codepage problems)?
Regardless of the above problem, I noticed a difference between QLatin1String and HbQString, managing string argument; basically, both receive
string argument from somewhere
QLatin1String
....... if( hb_pcount() == 1 && HB_ISCHAR( 1 ) )
{
pObj = new QLatin1String( hb_parcx( 1 ) );
HbQString
...... if( hb_pcount() == 1 && HB_ISCHAR( 1 ) )
{
void * pText01 = NULL;
pObj = new HBQString( hb_parstr_utf8( 1, &pText01, NULL ) );
hb_strfree( pText01 );
Best regads
Luigi Ferraris