This evening I started to "study" hbqt and I started from the sample
code I found on trolltech site... they are very basic samples based on
qt3 but so simple that they are still valid.
I converted sample 1 in a few minutes... just pay attention to
constructor that in Harbour is not overloaded...
    QPushButton hello( "Hello world!", 0 );
    hello.resize( 100, 30 );
becomes
  hello := QPushButton():new(  )
  hello:setText( "Hello, World!" )
  hello:resize( 100,30)

Sample 2 adds a "connect" and it becomes a bit more complicated:
    QPushButton quit( "Quit", 0 );
    quit.resize( 75, 30 );
    QObject::connect( &quit, SIGNAL(clicked()), &a, SLOT(quit()) );

I translated to

   quit := QPushButton():new( )
   quit:setText( "Quit!" )
   quit:resize( 100,30)
   QT_SLOTS_CONNECT( s_slots, quit, "clicked()", {|| MsgInfo( "pressed" ) } )

and it works... but I had to define and initialize s_slots and there
is no 1:1 match with QObject::connect ( I also added a MsgInfo
function, of course)

So I started to ask myself the necessity to have s_slots and s_events
(whatever you call them) defined and handled by the programmer.
And (I understand that QT_SLOTS_CONNECT has a more powerfull syntax
since it doesn't require you to create SLOT handlers in objects) was
thinking about the correct way to translate the line
QObject::connect( &quit, SIGNAL(clicked()), &a, SLOT(quit()) );
in harbour/Qt ...

Thanks,
Francesco
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to