Pritpal,

Remember this.-
http://lists.harbour-project.org/pipermail/harbour/2009-April/017872.html

Now you have this.-

#define hbqt_par_QIcon( n )                  ( ( QIcon ) hb_parc( n ) )
#define hbqt_par_QString( n )                ( ( QString ) hb_parc( n ) )

/*
 * QFont ()
 * QFont ( const QString & family, int pointSize = -1, int weight = -1, bool 
italic = false )
 * QFont ( const QFont & font, QPaintDevice * pd )
 * QFont ( const QFont & font )
 */
HB_FUNC( QT_QFONT )
{
   if( HB_IS_STRING( 1 ) )
   {
      hb_retptr( ( QFont* ) new QFont() );
   }
   else
   {
      hb_retptr( ( QFont* ) new QFont( hbqt_par_QString( 1 ),
                                       HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1,
                                       HB_ISNUM( 3 ) ? hb_parni( 3 ) : -1,
                                       hb_parl( 4 ) ) );
   }
}

Xavi

Pritpal Bedi escribió:
Thanks Przemek and Xavi



Przemyslaw Czerpak-2 wrote:
Not a 'const'. 'const' is only parameter attribute not type
which informs the compiler that given function will not change
passed value.

You have to convert it to QFont and then C++ will convert it to
QFont& following the function declaration.

Below it's self contain example which should help you in understanding
the C++ references.

If you think about it then you will find why C++ has to be such restricted
in type checking. Without it it will not be possible to compile most of
code.

best regards,
Przemek


#include <stdio.h>
void f( int & var )
{
   var += 10;
}

int main( void )
{
   int i = 5;
   int * p = &i;
   printf( "[%d]\n", i );
   f( i );
   printf( "[%d]\n", i );

   printf( "[%d]\n", *p );
   f( *p );
   printf( "[%d]\n", *p );
   return 0;
}


It has cleared my doubts.
I am worndering how I could not tested it like this or what I was doing wrong. It is as simple as:

hbqt_par_QWebView( 1 )->setUrl( *hbqt_par_QUrl( 2 ) );

Regards
Pritpal Bedi

PS : This discovery (sighhhh) has forced me to rewrite hbqtgen.prg.



_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to