From 6b32a9a872928bb3544e86d061793d3c33289cea Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 2 Mar 2011 02:35:21 +0000 Subject: [PATCH] 2011-03-01 18:22 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/hbqt_init.cpp + Added: HBQT_PUSHEVENT( , , , [nKeyboardModifiers], [cKey], [lRepeat=.f.], [ntimes=1] ) Current implementation is only for keyboard events, viz., QEvent_KeyPress and QEvent_KeyRelease. Mouse events needs QPoint() to be present which is in the gtcore namespace, so needs a different approach as per current hbQT scenario, do the needful. --- harbour/ChangeLog | 20 ++++++++++++ harbour/contrib/hbqt/qtgui/hbqt_init.cpp | 40 ++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d6132fa8f8..dc12927917 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,26 @@ The license applies to all entries newer than 2009-04-28. */ +2011-03-01 18:22 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtgui/hbqt_init.cpp + + Added: HBQT_PUSHEVENT( , , , + [nKeyboardModifiers], [cKey], [lRepeat=.f.], [ntimes=1] ) + + Current implementation is only for keyboard events, viz., + QEvent_KeyPress and QEvent_KeyRelease. Mouse events needs + QPoint() to be present which is in the gtcore namespace, + so needs a different approach as per current hbQT scenario, + do the needful. + +2011-03-01 17:38 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtnetwork/hbqt_init.cpp + * contrib/hbqt/qtnetwork/hbqtnetwork.hbx + * contrib/hbqt/qtnetwork/qth/filelist.hbm + ! Adjusted: to take use of new classes intead of NULL pointers. + + contrib/hbqt/qtnetwork/qth/QNetworkProxy.qth + + contrib/hbqt/qtnetwork/qth/QUrlInfo.qth + + Added: two pending classes. + 2011-03-01 16:02 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * examples/hbqt_tut/win01.prg * examples/hbqt_tut/win02.prg diff --git a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp index 1d35fc6792..1dd0c4a129 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp @@ -79,6 +79,7 @@ #include #include #include +#include #include @@ -587,6 +588,45 @@ static void hbqt_lib_exit( void * cargo ) HB_SYMBOL_UNUSED( cargo ); } +HB_FUNC( HBQT_PUSHEVENT ) +{ + switch( hb_parni( 2 ) ) + { + case QEvent::KeyPress: + case QEvent::KeyRelease: + case QEvent::ShortcutOverride: + { + QKeyEvent pKeyEvent = QKeyEvent( ( QEvent::Type ) hb_parni( 2 ), + hb_parni( 3 ), + ( Qt::KeyboardModifiers ) hb_parni( 4 ), + ( HB_ISCHAR( 5 ) ? hbqt_par_QString( 5 ) : QString() ), + ( HB_ISLOG( 6 ) ? hb_parl( 6 ) : false ), + ( HB_ISNUM( 7 ) ? hb_parni( 7 ) : 1 ) ); + + QObject * pObj = ( QObject * ) hbqt_gcpointer( 1 ); + s_app->sendEvent( pObj, &pKeyEvent ); + break; + } + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseButtonDblClick: + case QEvent::MouseMove: + { + #if 0 /* QPoint is in qrcore so how to handle ? qtcore is always required anyway for any Qt appln */ + QKeyEvent pMouseEvent = QMouseEvent( ( QEvent::Type ) hb_parni( 2 ), + hbqt_par_QPoint( 3 ), + ( Qt::MouseButton ) hb_parni( 4 ), + ( Qt::MouseButtons ) hb_parni( 5 ), + ( Qt::KeyboardModifiers ) hb_parni( 6 ) ); + + QObject * pObj = ( QObject * ) hbqt_gcpointer( 1 ); + s_app->sendEvent( pObj, &pMouseEvent ); + #endif + break; + } + } +} + HB_CALL_ON_STARTUP_BEGIN( _hbqtgui_init_ ) hb_vmAtInit( hbqt_lib_init, NULL ); hb_vmAtExit( hbqt_lib_exit, NULL );