2009-06-11 00:34 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* harbour/contrib/hbqt/generator/hbqtgen.prg
  * harbour/contrib/hbqt/generator/qt45.qtp
  * harbour/contrib/hbqt/hbqt.h

  + harbour/contrib/hbqt/hbqt_qkeyevent.cpp
  + harbour/contrib/hbqt/hbqt_qmouseevent.cpp

  * harbour/contrib/hbqt/hbqt_slots.cpp
  * harbour/contrib/hbqt/hbqt_slots.h
  * harbour/contrib/hbqt/Makefile_gen
  * harbour/contrib/hbqt/moc_slots.cpp

  + harbour/contrib/hbqt/qth/QKeyEvent.qth
  + harbour/contrib/hbqt/qth/QMouseEvent.qth
  + harbour/contrib/hbqt/TQKeyEvent.prg
  + harbour/contrib/hbqt/TQMouseEvent.prg
    + Added two more classes.
    + Added more event handlers.
This commit is contained in:
Pritpal Bedi
2009-06-11 07:38:52 +00:00
parent 059939de5f
commit 58bbdad1b4
14 changed files with 1859 additions and 558 deletions

View File

@@ -17,6 +17,26 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-11 00:34 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/hbqt/generator/hbqtgen.prg
* harbour/contrib/hbqt/generator/qt45.qtp
* harbour/contrib/hbqt/hbqt.h
+ harbour/contrib/hbqt/hbqt_qkeyevent.cpp
+ harbour/contrib/hbqt/hbqt_qmouseevent.cpp
* harbour/contrib/hbqt/hbqt_slots.cpp
* harbour/contrib/hbqt/hbqt_slots.h
* harbour/contrib/hbqt/Makefile_gen
* harbour/contrib/hbqt/moc_slots.cpp
+ harbour/contrib/hbqt/qth/QKeyEvent.qth
+ harbour/contrib/hbqt/qth/QMouseEvent.qth
+ harbour/contrib/hbqt/TQKeyEvent.prg
+ harbour/contrib/hbqt/TQMouseEvent.prg
+ Added two more classes.
+ Added more event handlers.
2009-06-11 08:24 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* INSTALL
* Stripped "\devl" from all examples dirs.

View File

@@ -62,6 +62,7 @@ CPP_SOURCES=\
hbqt_qimagewriter.cpp \
hbqt_qinputdialog.cpp \
hbqt_qinputevent.cpp \
hbqt_qkeyevent.cpp \
hbqt_qlabel.cpp \
hbqt_qlayout.cpp \
hbqt_qlayoutitem.cpp \
@@ -78,6 +79,7 @@ CPP_SOURCES=\
hbqt_qmenubar.cpp \
hbqt_qmessagebox.cpp \
hbqt_qmodelindex.cpp \
hbqt_qmouseevent.cpp \
hbqt_qobject.cpp \
hbqt_qpaintdevice.cpp \
hbqt_qpagesetupdialog.cpp \
@@ -264,6 +266,7 @@ PRG_SOURCES=\
TQImageWriter.prg \
TQInputDialog.prg \
TQInputEvent.prg \
TQKeyEvent.prg \
TQLabel.prg \
TQLayout.prg \
TQLayoutItem.prg \
@@ -280,6 +283,7 @@ PRG_SOURCES=\
TQMenuBar.prg \
TQMessageBox.prg \
TQModelIndex.prg \
TQMouseEvent.prg \
TQObject.prg \
TQPaintDevice.prg \
TQPageSetupDialog.prg \

View File

@@ -0,0 +1,89 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* QT wrapper main header
*
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
CREATE CLASS QKeyEvent INHERIT QInputEvent
VAR pParent
VAR pPtr
METHOD New()
METHOD count() INLINE Qt_QKeyEvent_count( ::pPtr )
METHOD isAutoRepeat() INLINE Qt_QKeyEvent_isAutoRepeat( ::pPtr )
METHOD key() INLINE Qt_QKeyEvent_key( ::pPtr )
METHOD matches( nKey ) INLINE Qt_QKeyEvent_matches( ::pPtr, nKey )
METHOD modifiers() INLINE Qt_QKeyEvent_modifiers( ::pPtr )
METHOD nativeModifiers() INLINE Qt_QKeyEvent_nativeModifiers( ::pPtr )
METHOD nativeScanCode() INLINE Qt_QKeyEvent_nativeScanCode( ::pPtr )
METHOD nativeVirtualKey() INLINE Qt_QKeyEvent_nativeVirtualKey( ::pPtr )
METHOD text() INLINE Qt_QKeyEvent_text( ::pPtr )
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD New( pParent ) CLASS QKeyEvent
::pParent := pParent
::pPtr := Qt_QKeyEvent( pParent )
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -0,0 +1,89 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* QT wrapper main header
*
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
CREATE CLASS QMouseEvent INHERIT QInputEvent
VAR pParent
VAR pPtr
METHOD New()
METHOD button() INLINE Qt_QMouseEvent_button( ::pPtr )
METHOD buttons() INLINE Qt_QMouseEvent_buttons( ::pPtr )
METHOD globalPos() INLINE Qt_QMouseEvent_globalPos( ::pPtr )
METHOD globalX() INLINE Qt_QMouseEvent_globalX( ::pPtr )
METHOD globalY() INLINE Qt_QMouseEvent_globalY( ::pPtr )
METHOD pos() INLINE Qt_QMouseEvent_pos( ::pPtr )
METHOD posF() INLINE Qt_QMouseEvent_posF( ::pPtr )
METHOD x() INLINE Qt_QMouseEvent_x( ::pPtr )
METHOD y() INLINE Qt_QMouseEvent_y( ::pPtr )
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD New( pParent ) CLASS QMouseEvent
::pParent := pParent
::pPtr := Qt_QMouseEvent( pParent )
RETURN Self
/*----------------------------------------------------------------------*/

File diff suppressed because it is too large Load Diff

View File

@@ -69,6 +69,7 @@ QImageReader.qth
QImageWriter.qth
QInputDialog.qth
QInputEvent.qth
QKeyEvent.qth
QLabel.qth
QLayout.qth
QLayoutItem.qth
@@ -85,6 +86,7 @@ QMenu.qth
QMenuBar.qth
QMessageBox.qth
QModelIndex.qth
QMouseEvent.qth
QObject.qth
QPaintDevice.qth
QPageSetupDialog.qth

View File

@@ -312,6 +312,8 @@
#define hbqt_par_QAbstractListModel( n ) ( ( QAbstractListModel* ) hb_parptr( n ) )
#define hbqt_par_QAbstractTableModel( n ) ( ( QAbstractTableModel* ) hb_parptr( n ) )
#define hbqt_par_QFileSystemModel( n ) ( ( QFileSystemModel* ) hb_parptr( n ) )
#define hbqt_par_QKeyEvent( n ) ( ( QKeyEvent* ) hb_parptr( n ) )
#define hbqt_par_QMouseEvent( n ) ( ( QMouseEvent* ) hb_parptr( n ) )
#define hbqt_par_QString( n ) ( ( QString ) hb_parc( n ) )
#define hbqt_par_QRgb( n ) ( hb_parnint( n ) )

View File

@@ -0,0 +1,150 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* QT wrapper main header
*
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
#include "hbapi.h"
#include "hbqt.h"
/*----------------------------------------------------------------------*/
#if QT_VERSION >= 0x040500
/*----------------------------------------------------------------------*/
#include <QtGui/QKeyEvent>
/*
* QKeyEvent ( Type type, int key, Qt::KeyboardModifiers modifiers, const QString & text = QString(), bool autorep = false, ushort count = 1 )
*/
HB_FUNC( QT_QKEYEVENT )
{
//hb_retptr( ( QKeyEvent * ) new QKeyEvent( *hbqt_par_QKeyEvent( 1 ) ) );
}
/*
* int count () const
*/
HB_FUNC( QT_QKEYEVENT_COUNT )
{
hb_retni( hbqt_par_QKeyEvent( 1 )->count() );
}
/*
* bool isAutoRepeat () const
*/
HB_FUNC( QT_QKEYEVENT_ISAUTOREPEAT )
{
hb_retl( hbqt_par_QKeyEvent( 1 )->isAutoRepeat() );
}
/*
* int key () const
*/
HB_FUNC( QT_QKEYEVENT_KEY )
{
hb_retni( hbqt_par_QKeyEvent( 1 )->key() );
}
/*
* bool matches ( QKeySequence::StandardKey key ) const
*/
HB_FUNC( QT_QKEYEVENT_MATCHES )
{
hb_retl( hbqt_par_QKeyEvent( 1 )->matches( ( QKeySequence::StandardKey ) hb_parni( 2 ) ) );
}
/*
* Qt::KeyboardModifiers modifiers () const
*/
HB_FUNC( QT_QKEYEVENT_MODIFIERS )
{
hb_retni( ( Qt::KeyboardModifiers ) hbqt_par_QKeyEvent( 1 )->modifiers() );
}
/*
* quint32 nativeModifiers () const
*/
HB_FUNC( QT_QKEYEVENT_NATIVEMODIFIERS )
{
hb_retni( hbqt_par_QKeyEvent( 1 )->nativeModifiers() );
}
/*
* quint32 nativeScanCode () const
*/
HB_FUNC( QT_QKEYEVENT_NATIVESCANCODE )
{
hb_retni( hbqt_par_QKeyEvent( 1 )->nativeScanCode() );
}
/*
* quint32 nativeVirtualKey () const
*/
HB_FUNC( QT_QKEYEVENT_NATIVEVIRTUALKEY )
{
hb_retni( hbqt_par_QKeyEvent( 1 )->nativeVirtualKey() );
}
/*
* QString text () const
*/
HB_FUNC( QT_QKEYEVENT_TEXT )
{
hb_retc( hbqt_par_QKeyEvent( 1 )->text().toLatin1().data() );
}
/*----------------------------------------------------------------------*/
#endif /* #if QT_VERSION >= 0x040500 */
/*----------------------------------------------------------------------*/

View File

@@ -0,0 +1,151 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* QT wrapper main header
*
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
#include "hbapi.h"
#include "hbqt.h"
/*----------------------------------------------------------------------*/
#if QT_VERSION >= 0x040500
/*----------------------------------------------------------------------*/
#include <QtGui/QMouseEvent>
/*
* QMouseEvent ( Type type, const QPoint & position, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers )
* QMouseEvent ( Type type, const QPoint & pos, const QPoint & globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers )
*/
HB_FUNC( QT_QMOUSEEVENT )
{
hb_retptr( ( QMouseEvent * ) new QMouseEvent( *hbqt_par_QMouseEvent( 1 ) ) );
}
/*
* Qt::MouseButton button () const
*/
HB_FUNC( QT_QMOUSEEVENT_BUTTON )
{
hb_retni( ( Qt::MouseButton ) hbqt_par_QMouseEvent( 1 )->button() );
}
/*
* Qt::MouseButtons buttons () const
*/
HB_FUNC( QT_QMOUSEEVENT_BUTTONS )
{
hb_retni( ( Qt::MouseButtons ) hbqt_par_QMouseEvent( 1 )->buttons() );
}
/*
* const QPoint & globalPos () const
*/
HB_FUNC( QT_QMOUSEEVENT_GLOBALPOS )
{
hb_retptr( new QPoint( hbqt_par_QMouseEvent( 1 )->globalPos() ) );
}
/*
* int globalX () const
*/
HB_FUNC( QT_QMOUSEEVENT_GLOBALX )
{
hb_retni( hbqt_par_QMouseEvent( 1 )->globalX() );
}
/*
* int globalY () const
*/
HB_FUNC( QT_QMOUSEEVENT_GLOBALY )
{
hb_retni( hbqt_par_QMouseEvent( 1 )->globalY() );
}
/*
* const QPoint & pos () const
*/
HB_FUNC( QT_QMOUSEEVENT_POS )
{
hb_retptr( new QPoint( hbqt_par_QMouseEvent( 1 )->pos() ) );
}
/*
* QPointF posF () const
*/
HB_FUNC( QT_QMOUSEEVENT_POSF )
{
hb_retptr( new QPointF( hbqt_par_QMouseEvent( 1 )->posF() ) );
}
/*
* int x () const
*/
HB_FUNC( QT_QMOUSEEVENT_X )
{
hb_retni( hbqt_par_QMouseEvent( 1 )->x() );
}
/*
* int y () const
*/
HB_FUNC( QT_QMOUSEEVENT_Y )
{
hb_retni( hbqt_par_QMouseEvent( 1 )->y() );
}
/*----------------------------------------------------------------------*/
#endif /* #if QT_VERSION >= 0x040500 */
/*----------------------------------------------------------------------*/

View File

@@ -65,6 +65,7 @@
#include <QWidget>
#include <QString>
#include <QList>
#include <QKeyEvent>
#define HBQT_EVT_CLICKED 1
#define HBQT_EVT_TRIGGERED 2
@@ -78,6 +79,7 @@
static Slots *s = NULL;
/*----------------------------------------------------------------------*/
static void SlotsExec( QWidget* widget, QString event, PHB_ITEM pItem )
{
@@ -131,6 +133,65 @@ Slots::~Slots()
{
}
bool Slots::event( QEvent * event )
{
bool bAccepted = true;
QObject *widget = qobject_cast<QObject *>( sender() );
for( int i = 0; i < list1.size(); ++i )
{
if( ( QObject* ) list1.at( i ) == ( QObject* ) widget )
{
if( ( ( QString ) list2.at( i ) == ( QString ) "event()" ) && ( ( bool ) list4.at( i ) == true ) )
{
PHB_ITEM pWidget = hb_itemPutPtr( NULL, ( QWidget * ) widget );
PHB_ITEM pEvent = hb_itemPutPtr( NULL, event );
bAccepted = hb_vmEvalBlockV( ( PHB_ITEM ) list3.at( i ), 2, pWidget, pEvent );
hb_itemRelease( pWidget );
hb_itemRelease( pEvent );
}
}
}
return bAccepted;
}
void Slots::keyPressEvent( QKeyEvent * event )
{
QObject *widget = qobject_cast<QObject *>( sender() );
for( int i = 0; i < list1.size(); ++i )
{
if( ( QObject* ) list1.at( i ) == ( QObject* ) widget )
{
if( ( ( QString ) list2.at( i ) == ( QString ) "keyPressEvent()" ) && ( ( bool ) list4.at( i ) == true ) )
{
PHB_ITEM pWidget = hb_itemPutPtr( NULL, ( QWidget * ) widget );
PHB_ITEM pEvent = hb_itemPutPtr( NULL, event );
hb_vmEvalBlockV( ( PHB_ITEM ) list3.at( i ), 2, pWidget, pEvent );
hb_itemRelease( pWidget );
hb_itemRelease( pEvent );
}
}
}
}
void Slots::mouseMoveEvent( QMouseEvent * event )
{
QObject *widget = qobject_cast<QObject *>( sender() );
for( int i = 0; i < list1.size(); ++i )
{
if( ( QObject* ) list1.at( i ) == ( QObject* ) widget )
{
if( ( ( QString ) list2.at( i ) == ( QString ) "mouseMoveEvent()" ) && ( ( bool ) list4.at( i ) == true ) )
{
PHB_ITEM pWidget = hb_itemPutPtr( NULL, ( QWidget * ) widget );
PHB_ITEM pEvent = hb_itemPutPtr( NULL, event );
hb_vmEvalBlockV( ( PHB_ITEM ) list3.at( i ), 2, pWidget, pEvent );
hb_itemRelease( pWidget );
hb_itemRelease( pEvent );
}
}
}
}
void Slots::clicked()
{
QWidget *widget = qobject_cast<QWidget *>( sender() );
@@ -249,7 +310,9 @@ HB_FUNC( QT_CONNECT_SIGNAL )
/* create object s, if not created yet */
if( s == NULL )
{
s = new Slots();
}
/* connect signal with slot
* if the list become to long, more classes can be created
@@ -275,7 +338,7 @@ HB_FUNC( QT_CONNECT_SIGNAL )
}
if( signal == ( QString ) "viewportEntered()" )
{
ret = widget->connect( widget, SIGNAL( viewportEntered() ), s, SLOT( viewportEntered() ) , Qt::AutoConnection );
ret = widget->connect( widget, SIGNAL( viewportEntered() ) , s, SLOT( viewportEntered() ) , Qt::AutoConnection );
}
if( signal == ( QString ) "pressed()" )
{
@@ -283,34 +346,56 @@ HB_FUNC( QT_CONNECT_SIGNAL )
}
if( signal == ( QString ) "released()" )
{
ret = widget->connect( widget, SIGNAL( released() ) , s, SLOT( released() ) , Qt::AutoConnection );
ret = widget->connect( widget, SIGNAL( released() ) ,
s, SLOT( released() ), Qt::AutoConnection );
}
/* Events with int parameter */
if( signal == ( QString ) "stateChanged(int)" )
{
ret = widget->connect( widget, SIGNAL( stateChanged( int ) ), s, SLOT( stateChanged( int ) ), Qt::AutoConnection );
ret = widget->connect( widget, SIGNAL( stateChanged( int ) ),
s, SLOT( stateChanged( int ) ), Qt::AutoConnection );
}
if( signal == ( QString ) "activated(int)" )
{
ret = widget->connect( widget, SIGNAL( activated( int ) ) , s, SLOT( activated( int ) ) , Qt::AutoConnection );
ret = widget->connect( widget, SIGNAL( activated( int ) ),
s, SLOT( activated( int ) ) , Qt::AutoConnection );
}
if( signal == ( QString ) "currentIndexChanged(int)" )
{
ret = widget->connect( widget, SIGNAL( currentIndexChanged( int ) ), s, SLOT( currentIndexChanged( int ) ), Qt::AutoConnection );
ret = widget->connect( widget, SIGNAL( currentIndexChanged( int ) ),
s, SLOT( currentIndexChanged( int ) ), Qt::AutoConnection );
}
if( signal == ( QString ) "highlighted(int)" )
{
ret = widget->connect( widget, SIGNAL( highlighted( int ) ) , s, SLOT( highlighted( int ) ) , Qt::AutoConnection );
ret = widget->connect( widget, SIGNAL( highlighted( int ) ) ,
s, SLOT( highlighted( int ) ) , Qt::AutoConnection );
}
/* Events with bool parameter */
if( signal == ( QString ) "triggered(bool)" )
{
ret = widget->connect( widget, SIGNAL( triggered( bool ) ) , s, SLOT( triggered( bool ) ) , Qt::AutoConnection );
ret = widget->connect( widget, SIGNAL( triggered( bool ) ),
s, SLOT( triggered( bool ) ) , Qt::AutoConnection );
}
/* Events with miscellaneous parameters */
if( signal == ( QString ) "clicked(QModelIndex)" )
{
ret = widget->connect( widget, SIGNAL( clicked_model( const QModelIndex & ) ), s, SLOT( clicked( const QModelIndex & ) ) , Qt::AutoConnection );
ret = widget->connect( widget, SIGNAL( clicked_model( const QModelIndex & ) ),
s, SLOT( clicked( const QModelIndex & ) ), Qt::AutoConnection );
}
if( signal == ( QString ) "event()" )
{
ret = widget->connect( widget, SIGNAL( event( QEvent * ) ),
s, SLOT( event( QEvent * ) ) , Qt::AutoConnection );
}
if( signal == ( QString ) "keyPressEvent()" )
{
ret = widget->connect( widget, SIGNAL( sg_keyPressEvent( QKeyEvent * ) ),
s, SLOT( keyPressEvent( QKeyEvent * ) ), Qt::AutoConnection );
}
if( signal == ( QString ) "mouseMoveEvent()" )
{
ret = widget->connect( widget, SIGNAL( sg_mouseMoveEvent( QMouseEvent * ) ),
s, SLOT( mouseMoveEvent( QMouseEvent * ) ), Qt::AutoConnection );
}
/* return connect result */
@@ -377,64 +462,65 @@ void release_codeblocks( void )
}
}
#if 0
HB_FUNC( QT_CONNECT_SIGNAL_1 )
/*----------------------------------------------------------------------*/
MyMainWindow::MyMainWindow()
{
QWidget * widget = ( QWidget* ) hb_parptr( 1 ); /* get sender */
int signal = hb_parni( 2 ); /* get signal */
PHB_ITEM codeblock = hb_itemNew( hb_param( 3, HB_IT_BLOCK | HB_IT_BYREF ) ); /* get codeblock */
bool ret = false; /* return value */
/* create object s, if not created yet */
if( s == NULL )
s = new Slots();
/* connect signal with slot
* if the list become to long, more classes can be created
* TODO: parameter Qt::AutoConnection
*/
switch( signal )
{
case HBQT_EVT_CLICKED:
ret = widget->connect( widget, SIGNAL( clicked() ) , s, SLOT( clicked() ) , Qt::AutoConnection );
break;
case HBQT_EVT_TRIGGERED:
ret = widget->connect( widget, SIGNAL( triggered() ) , s, SLOT( triggered() ) , Qt::AutoConnection );
break;
case HBQT_EVT_TRIGGERED_BOOL:
ret = widget->connect( widget, SIGNAL( triggered( bool ) ) , s, SLOT( triggered( bool ) ) , Qt::AutoConnection );
break;
case HBQT_EVT_HOVERED:
ret = widget->connect( widget, SIGNAL( hovered() ) , s, SLOT( hovered() ) , Qt::AutoConnection );
break;
case HBQT_EVT_STATECHANGED:
ret = widget->connect( widget, SIGNAL( stateChanged( int ) ), s, SLOT( stateChanged( int ) ), Qt::AutoConnection );
break;
case HBQT_EVT_PRESSED:
ret = widget->connect( widget, SIGNAL( pressed() ) , s, SLOT( pressed() ) , Qt::AutoConnection );
break;
case HBQT_EVT_RELEASED:
ret = widget->connect( widget, SIGNAL( released() ) , s, SLOT( released() ) , Qt::AutoConnection );
break;
}
/* return connect result */
hb_retl( ret );
/* if connected: store widget, signal, codeblock and flag
* TODO: locate a inactive entry and use it
*/
if( ret == true )
{
s->list1 << widget;
s->list2 << signal;
s->list3 << codeblock;
s->list4 << true;
}
Qt::WindowFlags flags = Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint |
Qt::WindowMinimizeButtonHint | Qt::WindowSystemMenuHint |
Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::Window ;
setWindowFlags( flags );
setFocusPolicy( Qt::StrongFocus );
setAttribute( Qt::WA_DeleteOnClose );
}
MyMainWindow::~MyMainWindow( void )
{
}
void MyMainWindow::closeEvent( QCloseEvent *event )
{
event->accept();
}
MyDrawingArea::MyDrawingArea(QWidget *parent)
: QWidget(parent)
{
setAttribute( Qt::WA_StaticContents );
setAttribute( Qt::WA_PaintOnScreen );
setAttribute( Qt::WA_DeleteOnClose );
setFocusPolicy( Qt::StrongFocus );
setMouseTracking( true );
setAttribute( Qt::WA_InputMethodEnabled, true );
}
MyDrawingArea::~MyDrawingArea( void )
{
}
void MyDrawingArea::mouseMoveEvent( QMouseEvent * event )
{
emit sg_mouseMoveEvent( event );
}
void MyDrawingArea::keyPressEvent( QKeyEvent * event )
{
emit sg_keyPressEvent( event );
}
HB_FUNC( QT_MYMAINWINDOW )
{
hb_retptr( ( MyMainWindow * ) new MyMainWindow() );
}
HB_FUNC( QT_MYDRAWINGAREA )
{
hb_retptr( ( MyDrawingArea * ) new MyDrawingArea() );
}
#endif
/*----------------------------------------------------------------------*/
#endif

View File

@@ -58,8 +58,13 @@
#define SLOTS_H
#include <QObject>
#include <QMainWindow>
#include <QList>
#include <QModelIndex>
#include <QEvent>
#include <QKeyEvent>
#include <QMouseEvent>
#include "hbapi.h"
#include "hbapiitm.h"
@@ -68,7 +73,7 @@ class Slots: public QObject
{
Q_OBJECT
public:
public:
Slots( QObject *parent = 0 );
~Slots();
QList<QWidget*> list1;
@@ -76,7 +81,7 @@ class Slots: public QObject
QList<PHB_ITEM> list3;
QList<bool> list4;
public slots:
public slots:
void clicked();
void triggered();
void triggered( bool checked );
@@ -90,6 +95,85 @@ class Slots: public QObject
void returnPressed();
void clicked_model( const QModelIndex & index );
void viewportEntered();
bool event( QEvent *event );
void keyPressEvent( QKeyEvent * event );
void mouseMoveEvent( QMouseEvent * event );
#if 0
void accessibleEvent();
void actionEvent();
void childEvent();
void closeEvent();
void customEvent();
void dragLeaveEvent();
void dropEvent();
void dynamicPropertyChangeEvent();
void fileOpenEvent();
void focusEvent();
void graphicsSceneEvent();
void helpEvent();
void hideEvent();
void hoverEvent();
void iconDragEvent();
void inputEvent();
void inputMethodEvent();
void moveEvent();
void paintEvent();
void resizeEvent();
void shortcutEvent();
void showEvent();
void statusTipEvent();
void timerEvent();
void whatsThisClickedEvent();
void windowStateChangeEvent();
#endif
};
class MyDrawingArea : public QWidget
{
Q_OBJECT
public:
MyDrawingArea( QWidget *parent = 0 );
virtual ~MyDrawingArea( void );
#if 0
protected slots:
void keyReleaseEvent( QKeyEvent * event );
void mousePressEvent( QMouseEvent * event );
void mouseReleaseEvent( QMouseEvent * event );
void mouseDoubleClickEvent( QMouseEvent * event );
void paintEvent( QPaintEvent * event );
void resizeEvent( QResizeEvent * event );
void wheelEvent( QWheelEvent * event );
void timerEvent( QTimerEvent * event );
void focusInEvent( QFocusEvent * event );
void focusOutEvent( QFocusEvent * event );
void moveEvent( QMoveEvent * event );
bool event( QEvent * event );
#endif
void keyPressEvent( QKeyEvent * event );
void mouseMoveEvent( QMouseEvent * event );
signals:
void sg_mouseMoveEvent( QMouseEvent * event );
void sg_keyPressEvent( QKeyEvent * event );
};
class MyMainWindow : public QMainWindow
{
Q_OBJECT
public:
MyMainWindow();
virtual ~MyMainWindow();
public:
void closeEvent( QCloseEvent *event );
};
#endif

View File

@@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file hbqt_slots.h
**
** Created: Sun Jun 7 21:29:21 2009
** Created: Thu Jun 11 00:20:48 2009
** by: The Qt Meta Object Compiler version 61 (Qt 4.5.0)
**
** WARNING! All changes made in this file will be lost!
@@ -23,7 +23,7 @@ static const uint qt_meta_data_Slots[] = {
2, // revision
0, // classname
0, 0, // classinfo
13, 12, // methods
16, 12, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
@@ -42,6 +42,9 @@ static const uint qt_meta_data_Slots[] = {
171, 6, 6, 6, 0x0a,
187, 108, 6, 6, 0x0a,
214, 6, 6, 6, 0x0a,
243, 237, 232, 6, 0x0a,
258, 237, 6, 6, 0x0a,
284, 237, 6, 6, 0x0a,
0 // eod
};
@@ -53,6 +56,9 @@ static const char qt_meta_stringdata_Slots[] = {
"index\0activated(int)\0currentIndexChanged(int)\0"
"highlighted(int)\0returnPressed()\0"
"clicked_model(QModelIndex)\0viewportEntered()\0"
"bool\0event\0event(QEvent*)\0"
"keyPressEvent(QKeyEvent*)\0"
"mouseMoveEvent(QMouseEvent*)\0"
};
const QMetaObject Slots::staticMetaObject = {
@@ -93,11 +99,129 @@ int Slots::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
case 10: returnPressed(); break;
case 11: clicked_model((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break;
case 12: viewportEntered(); break;
case 13: { bool _r = event((*reinterpret_cast< QEvent*(*)>(_a[1])));
if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break;
case 14: keyPressEvent((*reinterpret_cast< QKeyEvent*(*)>(_a[1]))); break;
case 15: mouseMoveEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
default: ;
}
_id -= 13;
_id -= 16;
}
return _id;
}
static const uint qt_meta_data_MyDrawingArea[] = {
// content:
2, // revision
0, // classname
0, 0, // classinfo
2, 12, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
// signals: signature, parameters, type, tag, flags
21, 15, 14, 14, 0x05,
53, 15, 14, 14, 0x05,
0 // eod
};
static const char qt_meta_stringdata_MyDrawingArea[] = {
"MyDrawingArea\0\0event\0"
"sg_mouseMoveEvent(QMouseEvent*)\0"
"sg_keyPressEvent(QKeyEvent*)\0"
};
const QMetaObject MyDrawingArea::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_MyDrawingArea,
qt_meta_data_MyDrawingArea, 0 }
};
const QMetaObject *MyDrawingArea::metaObject() const
{
return &staticMetaObject;
}
void *MyDrawingArea::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_MyDrawingArea))
return static_cast<void*>(const_cast< MyDrawingArea*>(this));
return QWidget::qt_metacast(_clname);
}
int MyDrawingArea::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: sg_mouseMoveEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
case 1: sg_keyPressEvent((*reinterpret_cast< QKeyEvent*(*)>(_a[1]))); break;
default: ;
}
_id -= 2;
}
return _id;
}
// SIGNAL 0
void MyDrawingArea::sg_mouseMoveEvent(QMouseEvent * _t1)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 0, _a);
}
// SIGNAL 1
void MyDrawingArea::sg_keyPressEvent(QKeyEvent * _t1)
{
void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) };
QMetaObject::activate(this, &staticMetaObject, 1, _a);
}
static const uint qt_meta_data_MyMainWindow[] = {
// content:
2, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0 // eod
};
static const char qt_meta_stringdata_MyMainWindow[] = {
"MyMainWindow\0"
};
const QMetaObject MyMainWindow::staticMetaObject = {
{ &QMainWindow::staticMetaObject, qt_meta_stringdata_MyMainWindow,
qt_meta_data_MyMainWindow, 0 }
};
const QMetaObject *MyMainWindow::metaObject() const
{
return &staticMetaObject;
}
void *MyMainWindow::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_MyMainWindow))
return static_cast<void*>(const_cast< MyMainWindow*>(this));
return QMainWindow::qt_metacast(_clname);
}
int MyMainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
QT_END_MOC_NAMESPACE

View File

@@ -0,0 +1,101 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* QT Source Generator for Harbour
*
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
;
; Header File to Generate QT Wrapper Sources
;
<CLASS>
Inherits = QInputEvent
Type = Core
New =
</CLASS>
<CODE>
#include <QtGui/QKeyEvent>
/*
* QKeyEvent ( Type type, int key, Qt::KeyboardModifiers modifiers, const QString & text = QString(), bool autorep = false, ushort count = 1 )
*/
HB_FUNC( QT_QKEYEVENT )
{
//hb_retptr( ( QKeyEvent * ) new QKeyEvent( *hbqt_par_QKeyEvent( 1 ) ) );
}
</CODE>
<ENUMS>
</ENUMS>
<PROTOS>
int count () const
bool isAutoRepeat () const
int key () const
bool matches ( QKeySequence::StandardKey key ) const
Qt::KeyboardModifiers modifiers () const
quint32 nativeModifiers () const
quint32 nativeScanCode () const
quint32 nativeVirtualKey () const
QString text () const
</PROTOS>
<SLOTS>
</SLOTS>
<SIGNALS>
</SIGNALS>
<VARIABLES>
</VARIABLES>

View File

@@ -0,0 +1,102 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* QT Source Generator for Harbour
*
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
;
; Header File to Generate QT Wrapper Sources
;
<CLASS>
Inherits = QInputEvent
Type = Core
New =
</CLASS>
<CODE>
#include <QtGui/QMouseEvent>
/*
* QMouseEvent ( Type type, const QPoint & position, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers )
* QMouseEvent ( Type type, const QPoint & pos, const QPoint & globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers )
*/
HB_FUNC( QT_QMOUSEEVENT )
{
hb_retptr( ( QMouseEvent * ) new QMouseEvent( *hbqt_par_QMouseEvent( 1 ) ) );
}
</CODE>
<ENUMS>
</ENUMS>
<PROTOS>
Qt::MouseButton button () const
Qt::MouseButtons buttons () const
const QPoint & globalPos () const
int globalX () const
int globalY () const
const QPoint & pos () const
QPointF posF () const
int x () const
int y () const
</PROTOS>
<SLOTS>
</SLOTS>
<SIGNALS>
</SIGNALS>
<VARIABLES>
</VARIABLES>