2009-12-14 10:01 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbqt/hbqt.h
* contrib/hbqt/hbqt_hbqtableview.cpp
* contrib/hbqt/qtgui/QTableView.cpp
* contrib/hbqt/qtgui/TQTableView.prg
* contrib/hbqt/qth/QTableView.qth
* contrib/hbxbp/xbpbrowse.prg
+ Implemented GC collectible pointers for HBTableView() class.
This commit is contained in:
@@ -17,6 +17,15 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-12-14 10:01 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* contrib/hbqt/hbqt.h
|
||||
* contrib/hbqt/hbqt_hbqtableview.cpp
|
||||
* contrib/hbqt/qtgui/QTableView.cpp
|
||||
* contrib/hbqt/qtgui/TQTableView.prg
|
||||
* contrib/hbqt/qth/QTableView.qth
|
||||
* contrib/hbxbp/xbpbrowse.prg
|
||||
+ Implemented GC collectible pointers for HBTableView() class.
|
||||
|
||||
2009-12-14 10:01 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* contrib/hbqt/hbqt.h
|
||||
* contrib/hbqt/hbqt_hbdbfmodel.cpp
|
||||
|
||||
@@ -379,8 +379,7 @@ extern int hbqt_getmemused( void );
|
||||
|
||||
#define hbqt_par_HBDbfModel( n ) ( ( HBDbfModel * ) hbqt_gcpointer( n ) )
|
||||
#define hbqt_par_HBQMainWindow( n ) ( ( HBQMainWindow * ) hbqt_gcpointer( n ) )
|
||||
|
||||
#define hbqt_par_HBQTableView( n ) ( ( HBQTableView* ) hb_parptr( n ) )
|
||||
#define hbqt_par_HBQTableView( n ) ( ( HBQTableView * ) hbqt_gcpointer( n ) )
|
||||
|
||||
#define hbqt_par_QString( n ) ( ( QString ) hb_parcx( n ) )
|
||||
#define hbqt_par_QRgb( n ) ( hb_parnint( n ) )
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
|
||||
#if QT_VERSION >= 0x040500
|
||||
|
||||
#include <QPointer>
|
||||
#include "hbqt_hbqtableview.h"
|
||||
|
||||
HBQTableView::HBQTableView( QWidget * parent ) : QTableView( parent )
|
||||
@@ -67,11 +68,6 @@ HBQTableView::HBQTableView( QWidget * parent ) : QTableView( parent )
|
||||
|
||||
HBQTableView::~HBQTableView()
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "HBQTableView::~HBQTableView: BEGIN %i %i", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
|
||||
|
||||
destroy();
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "HBQTableView::~HBQTableView: END %i %i", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
|
||||
}
|
||||
|
||||
void HBQTableView::keyPressEvent( QKeyEvent * event )
|
||||
@@ -112,8 +108,6 @@ void HBQTableView::resizeEvent( QResizeEvent * event )
|
||||
QModelIndex HBQTableView::moveCursor( HBQTableView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers )
|
||||
{
|
||||
// HB_TRACE( HB_TR_DEBUG, ( "HBQTableView::moveCursor( action=%i %i )", cursorAction, QAbstractItemView::MoveDown ) );
|
||||
|
||||
//emit sg_moveCursor( cursorAction, modifiers );
|
||||
return QTableView::moveCursor( cursorAction, modifiers );
|
||||
}
|
||||
|
||||
@@ -134,4 +128,74 @@ void HBQTableView::scrollTo( const QModelIndex & index, QAbstractItemView::Scrol
|
||||
QTableView::scrollTo( index, hint );
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void * ph;
|
||||
QT_G_FUNC_PTR func;
|
||||
QPointer< HBQTableView > pq;
|
||||
} QGC_POINTER_HBQTableView;
|
||||
|
||||
QT_G_FUNC( release_HBQTableView )
|
||||
{
|
||||
QGC_POINTER_HBQTableView * p = ( QGC_POINTER_HBQTableView * ) Cargo;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "release_HBQTableView p=%p", p));
|
||||
HB_TRACE( HB_TR_DEBUG, ( "release_HBQTableView ph=%p pq=%p", p->ph, (void *)(p->pq)));
|
||||
|
||||
if( p && p->ph && p->pq )
|
||||
{
|
||||
const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject();
|
||||
if( ( QString ) m->className() != ( QString ) "QObject" )
|
||||
{
|
||||
switch( hbqt_get_object_release_method() )
|
||||
{
|
||||
case HBQT_RELEASE_WITH_DELETE:
|
||||
delete ( ( HBQTableView * ) p->ph );
|
||||
break;
|
||||
case HBQT_RELEASE_WITH_DESTRUTOR:
|
||||
( ( HBQTableView * ) p->ph )->~HBQTableView();
|
||||
break;
|
||||
case HBQT_RELEASE_WITH_DELETE_LATER:
|
||||
( ( HBQTableView * ) p->ph )->deleteLater();
|
||||
break;
|
||||
}
|
||||
p->ph = NULL;
|
||||
HB_TRACE( HB_TR_DEBUG, ( "release_HBQTableView Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "NO release_HBQTableView Object Name Missing!" ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "DEL release_HBQTableView Object Already deleted!" ) );
|
||||
}
|
||||
}
|
||||
|
||||
void * gcAllocate_HBQTableView( void * pObj )
|
||||
{
|
||||
QGC_POINTER_HBQTableView * p = ( QGC_POINTER_HBQTableView * ) hb_gcAllocate( sizeof( QGC_POINTER_HBQTableView ), gcFuncs() );
|
||||
|
||||
p->ph = pObj;
|
||||
p->func = release_HBQTableView;
|
||||
new( & p->pq ) QPointer< HBQTableView >( ( HBQTableView * ) pObj );
|
||||
HB_TRACE( HB_TR_DEBUG, ( " new_HBQTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
|
||||
return( p );
|
||||
}
|
||||
|
||||
HB_FUNC( QT_HBQTABLEVIEW )
|
||||
{
|
||||
void * pObj = NULL;
|
||||
|
||||
pObj = ( HBQTableView* ) new HBQTableView( hbqt_par_QWidget( 1 ) ) ;
|
||||
|
||||
hb_retptrGC( gcAllocate_HBQTableView( pObj ) );
|
||||
}
|
||||
|
||||
HB_FUNC( QT_HBQTABLEVIEW_NAVIGATE )
|
||||
{
|
||||
hb_retptr( new QModelIndex( hbqt_par_HBQTableView( 1 )->navigate( hb_parni( 2 ) ) ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -77,22 +77,6 @@
|
||||
* ~QTableView ()
|
||||
*/
|
||||
|
||||
HB_FUNC( QT_HBQTABLEVIEW )
|
||||
{
|
||||
hb_retptr( new HBQTableView( hbqt_par_QWidget( 1 ) ) );
|
||||
}
|
||||
|
||||
HB_FUNC( QT_HBQTABLEVIEW_NAVIGATE )
|
||||
{
|
||||
hb_retptr( new QModelIndex( hbqt_par_HBQTableView( 1 )->navigate( hb_parni( 2 ) ) ) );
|
||||
}
|
||||
|
||||
/* TOFIX: Leak if .prg code doesn't call this explicitly. */
|
||||
HB_FUNC( QT_HBQTABLEVIEW_DESTROY )
|
||||
{
|
||||
hbqt_par_HBQTableView( 1 )->~HBQTableView();
|
||||
}
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -126,16 +110,25 @@ QT_G_FUNC( release_QTableView )
|
||||
break;
|
||||
}
|
||||
p->ph = NULL;
|
||||
HB_TRACE( HB_TR_DEBUG, ( "release_QTableView Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "release_QTableView Object deleted!" ) );
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( " YES release_QTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "NO release_QTableView Object Name Missing!" ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "release_QTableView Object Name Missing!" ) );
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( " NO release_QTableView" );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "DEL release_QTableView Object Already deleted!" ) );
|
||||
HB_TRACE( HB_TR_DEBUG, ( "release_QTableView Object Allready deleted!" ) );
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( " DEL release_QTableView" );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +139,9 @@ void * gcAllocate_QTableView( void * pObj )
|
||||
p->ph = pObj;
|
||||
p->func = release_QTableView;
|
||||
new( & p->pq ) QPointer< QTableView >( ( QTableView * ) pObj );
|
||||
HB_TRACE( HB_TR_DEBUG, ( " new_QTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );
|
||||
#if defined( __HB_DEBUG__ )
|
||||
hbqt_debug( " new_QTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() );
|
||||
#endif
|
||||
return( p );
|
||||
}
|
||||
|
||||
|
||||
@@ -304,7 +304,6 @@ CREATE CLASS HBQTableView INHERIT QTableView
|
||||
|
||||
METHOD new( pParent )
|
||||
METHOD navigate( nCursorAction, nModifiers )
|
||||
METHOD destroy()
|
||||
|
||||
ENDCLASS
|
||||
|
||||
@@ -315,7 +314,4 @@ METHOD HBQTableView:new( pParent )
|
||||
METHOD HBQTableView:navigate( nCursorAction, nModifiers )
|
||||
RETURN Qt_HBQTableView_navigate( ::pPtr, nCursorAction, nModifiers )
|
||||
|
||||
METHOD HBQTableView:destroy()
|
||||
RETURN Qt_HBQTableView_destroy( ::pPtr )
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ CREATE CLASS HBQTableView INHERIT QTableView
|
||||
|
||||
METHOD new( pParent )
|
||||
METHOD navigate( nCursorAction, nModifiers )
|
||||
METHOD destroy()
|
||||
|
||||
ENDCLASS
|
||||
|
||||
@@ -75,9 +74,6 @@ METHOD HBQTableView:new( pParent )
|
||||
METHOD HBQTableView:navigate( nCursorAction, nModifiers )
|
||||
RETURN Qt_HBQTableView_navigate( ::pPtr, nCursorAction, nModifiers )
|
||||
|
||||
METHOD HBQTableView:destroy()
|
||||
RETURN Qt_HBQTableView_destroy( ::pPtr )
|
||||
|
||||
</SUBCLASS>
|
||||
|
||||
<CODE>
|
||||
@@ -94,22 +90,6 @@ HB_FUNC( QT_QTABLEVIEW )
|
||||
hb_retptr( ( QTableView* ) new QTableView( hbqt_par_QWidget( 1 ) ) );
|
||||
}
|
||||
|
||||
HB_FUNC( QT_HBQTABLEVIEW )
|
||||
{
|
||||
hb_retptr( new HBQTableView( hbqt_par_QWidget( 1 ) ) );
|
||||
}
|
||||
|
||||
HB_FUNC( QT_HBQTABLEVIEW_NAVIGATE )
|
||||
{
|
||||
hb_retptr( new QModelIndex( hbqt_par_HBQTableView( 1 )->navigate( hb_parni( 2 ) ) ) );
|
||||
}
|
||||
|
||||
/* TOFIX: Leak if .prg code doesn't call this explicitly. */
|
||||
HB_FUNC( QT_HBQTABLEVIEW_DESTROY )
|
||||
{
|
||||
hbqt_par_HBQTableView( 1 )->~HBQTableView();
|
||||
}
|
||||
|
||||
</CODE>
|
||||
|
||||
<PROTOS>
|
||||
|
||||
@@ -718,20 +718,20 @@ METHOD XbpBrowse:destroy()
|
||||
::oHScrollBar:pPtr := 0
|
||||
::oVScrollBar:pPtr := 0
|
||||
|
||||
::oLeftView:destroy()
|
||||
::oLeftView:pPtr := 0
|
||||
::oLeftDbfModel:pPtr := 0
|
||||
::oLeftVHeaderView:pPtr := 0
|
||||
::oLeftHeaderView:pPtr := 0
|
||||
::oLeftFooterView:pPtr := 0
|
||||
::oLeftFooterModel:pPtr := 0
|
||||
|
||||
::oRightView:destroy()
|
||||
::oRightView:pPtr := 0
|
||||
::oRightHeaderView:pPtr := 0
|
||||
::oRightDbfModel:pPtr := 0
|
||||
::oRightFooterView:pPtr := 0
|
||||
::oRightFooterModel:pPtr := 0
|
||||
|
||||
::oTableView:destroy()
|
||||
::oTableView:pPtr := 0
|
||||
::oVHeaderView:pPtr := 0
|
||||
::oDbfModel:pPtr := 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user