From 29ae91b0af66a80754c10b3804fe28c233dbf346 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sat, 31 Oct 2009 17:36:49 +0000 Subject: [PATCH] 2009-10-31 10:23 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/generator/hbqtgen.prg * contrib/hbqt/hbqt.h * contrib/hbqt/hbqt_destruct.cpp * contrib/hbqt/hbqt_slots.cpp * contrib/hbqt/hbqt_slots.h * contrib/hbqt/moc_slots.cpp * contrib/hbxbp/tests/demoxbp.prg * contrib/hbxbp/xbpbrowse.prg * contrib/hbxbp/xbpdialog.prg * contrib/hbxbp/xbpgeneric.prg * contrib/hbxbp/xbpmenubar.prg * contrib/hbxbp/xbpwindow.prg * contrib/qtgui/QTableView.cpp * contrib/qtgui/TQTableView.prg ! Some more debug information included. Please note that the build may be broken, so bear with me for a couple of days. Lorenzo, you can continue with experiments. --- harbour/ChangeLog | 19 ++++++ harbour/contrib/hbqt/generator/hbqtgen.prg | 20 +++++- harbour/contrib/hbqt/hbqt.h | 3 +- harbour/contrib/hbqt/hbqt_destruct.cpp | 5 ++ harbour/contrib/hbqt/hbqt_slots.cpp | 78 +++++++++++++++++++--- harbour/contrib/hbqt/hbqt_slots.h | 6 +- harbour/contrib/hbqt/moc_slots.cpp | 6 +- harbour/contrib/hbqt/qtgui/QTableView.cpp | 22 +++++- harbour/contrib/hbqt/qtgui/TQTableView.prg | 4 ++ harbour/contrib/hbqt/qth/QTableView.qth | 10 +++ harbour/contrib/hbxbp/tests/demoxbp.prg | 52 ++++++++------- harbour/contrib/hbxbp/xbpbrowse.prg | 6 +- harbour/contrib/hbxbp/xbpdialog.prg | 12 +++- harbour/contrib/hbxbp/xbpgeneric.prg | 11 +++ harbour/contrib/hbxbp/xbpmenubar.prg | 13 +++- harbour/contrib/hbxbp/xbpwindow.prg | 7 +- 16 files changed, 216 insertions(+), 58 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 82bf2fadaa..1b4feefca8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,25 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-10-31 10:23 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/generator/hbqtgen.prg + * contrib/hbqt/hbqt.h + * contrib/hbqt/hbqt_destruct.cpp + * contrib/hbqt/hbqt_slots.cpp + * contrib/hbqt/hbqt_slots.h + * contrib/hbqt/moc_slots.cpp + * contrib/hbxbp/tests/demoxbp.prg + * contrib/hbxbp/xbpbrowse.prg + * contrib/hbxbp/xbpdialog.prg + * contrib/hbxbp/xbpgeneric.prg + * contrib/hbxbp/xbpmenubar.prg + * contrib/hbxbp/xbpwindow.prg + * contrib/qtgui/QTableView.cpp + * contrib/qtgui/TQTableView.prg + ! Some more debug information included. + Please note that the build may be broken, so bear with me for a + couple of days. Lorenzo, you can continue with experiments. + 2009-10-31 16:42 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/rddads/ads1.c ! In APPEND metohd generate RT error EG_APPENDLOCK only if ACE returns diff --git a/harbour/contrib/hbqt/generator/hbqtgen.prg b/harbour/contrib/hbqt/generator/hbqtgen.prg index 8254ce35a5..20b6e19f6a 100644 --- a/harbour/contrib/hbqt/generator/hbqtgen.prg +++ b/harbour/contrib/hbqt/generator/hbqtgen.prg @@ -469,7 +469,7 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) aadd( cpp_, "{ " ) IF lDestructor aadd( cpp_, "#if defined(__debug__)" ) - aadd( cpp_, ' hb_snprintf( str, sizeof(str), "' + 'release_' + cWidget + '" ); OutputDebugString( str );' ) + aadd( cpp_, 'hb_snprintf( str, sizeof(str), "' + 'release_' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str );' ) aadd( cpp_, "#endif" ) aadd( cpp_, " void * ph = ( void * ) Cargo; " ) aadd( cpp_, " if( ph ) " ) @@ -484,7 +484,7 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) aadd( cpp_, " else" ) aadd( cpp_, " {" ) aadd( cpp_, "#if defined(__debug__)" ) - aadd( cpp_, ' hb_snprintf( str, sizeof(str), "' + ' Object Name Missing: ' + cWidget + '" ); OutputDebugString( str );' ) + aadd( cpp_, 'hb_snprintf( str, sizeof(str), "' + ' Object Name Missing: ' + cWidget + '" ); OutputDebugString( str );' ) aadd( cpp_, "#endif" ) aadd( cpp_, " }" ) ELSE @@ -492,6 +492,12 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) aadd( cpp_, " ph = NULL;" ) ENDIF aadd( cpp_, " }" ) + aadd( cpp_, " else" ) + aadd( cpp_, " {" ) + aadd( cpp_, "#if defined(__debug__)" ) + aadd( cpp_, 'hb_snprintf( str, sizeof(str), "' + '! ph____' + cWidget + '" ); OutputDebugString( str );' ) + aadd( cpp_, "#endif" ) + aadd( cpp_, " }" ) ELSE aadd( cpp_, " HB_SYMBOL_UNUSED( Cargo );" ) ENDIF @@ -520,6 +526,11 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) ELSE aadd( cpp_, " void * pObj = NULL;" ) ENDIF + + aadd( cpp_, "#if defined(__debug__)" ) + aadd( cpp_, 'hb_snprintf( str, sizeof(str), "' + ' ' + IF( lDestructor, 'GC', 'NON-GC' ) + ': new ' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str );' ) + aadd( cpp_, "#endif" ) + aadd( cpp_, "" ) FOR i := 3 TO len( new_ ) - 1 IF left( ltrim( new_[ i ] ), 2 ) != "//" @@ -533,6 +544,11 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) ENDIF NEXT aadd( cpp_, "" ) + + aadd( cpp_, "#if defined(__debug__)" ) + aadd( cpp_, 'hb_snprintf( str, sizeof(str), "' + ' ' + IF( lDestructor, 'GC', 'NON-GC' ) + ': ' + pad( " ", 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str );' ) + aadd( cpp_, "#endif" ) + //IF lObject .or. IsMemObject( cWidget ) IF lDestructor aadd( cpp_, " p->ph = pObj;" ) diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index 70da9b13b4..d89c3ddaf3 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -64,7 +64,8 @@ //#define __debug__ #if defined(__debug__) #include - static char str[ 50 ]; + static char str[ 100 ]; + int hb_getMemUsed( void ); #endif #if 0 diff --git a/harbour/contrib/hbqt/hbqt_destruct.cpp b/harbour/contrib/hbqt/hbqt_destruct.cpp index 8081440d7c..336713b8f7 100644 --- a/harbour/contrib/hbqt/hbqt_destruct.cpp +++ b/harbour/contrib/hbqt/hbqt_destruct.cpp @@ -103,6 +103,11 @@ void * hbqt_ptrTOgcpointer( void * ptr, QT_G_FUNC_PTR func ) QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); p->ph = ptr; p->func = func; + +#if defined(__debug__) +hb_snprintf( str, sizeof(str), " hbqt_ptrTOgcpointer( %p, %p ) %i %i", ptr, func, ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); +#endif + return p; } diff --git a/harbour/contrib/hbqt/hbqt_slots.cpp b/harbour/contrib/hbqt/hbqt_slots.cpp index 51c9f26b05..78bbc47988 100644 --- a/harbour/contrib/hbqt/hbqt_slots.cpp +++ b/harbour/contrib/hbqt/hbqt_slots.cpp @@ -1897,6 +1897,13 @@ HbTableView::HbTableView( QWidget * parent ) : QTableView( parent ) } HbTableView::~HbTableView() { +#if defined(__debug__) +hb_snprintf( str, sizeof( str ), "HbTableView::~HbTableView() 0 %i %i", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); +#endif + destroy(); +#if defined(__debug__) +hb_snprintf( str, sizeof( str ), "HbTableView::~HbTableView() 1 %i %i", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); +#endif } void HbTableView::keyPressEvent( QKeyEvent * event ) { @@ -1928,7 +1935,7 @@ void HbTableView::resizeEvent( QResizeEvent * event ) } QModelIndex HbTableView::moveCursor( HbTableView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers ) { -// char str[ 50 ]; hb_snprintf( str, sizeof( str ), "HbTableView: action=%i %i", cursorAction, QAbstractItemView::MoveDown ); OutputDebugString( str ); +//hb_snprintf( str, sizeof( str ), "HbTableView: action=%i %i", cursorAction, QAbstractItemView::MoveDown ); OutputDebugString( str ); //emit sg_moveCursor( cursorAction, modifiers ); return QTableView::moveCursor( cursorAction, modifiers ); @@ -1943,7 +1950,7 @@ void HbTableView::scrollContentsBy( int x, int y ) } void HbTableView::scrollTo( const QModelIndex & index, QAbstractItemView::ScrollHint hint ) { -//char str[ 50 ]; hb_snprintf( str, sizeof( str ), "HbTableView:scrollTo row = %i col = %i", index.row(),index.column() ); OutputDebugString( str ); +//hb_snprintf( str, sizeof( str ), "HbTableView:scrollTo row = %i col = %i", index.row(),index.column() ); OutputDebugString( str ); QTableView::scrollTo( index, hint ); } @@ -2215,16 +2222,19 @@ MyMainWindow::MyMainWindow( PHB_ITEM pBlock, int iThreadID ) block = pBlock; threadID = iThreadID; - activated = true; - painter = new QPainter( this ); } MyMainWindow::~MyMainWindow( void ) { - delete painter; +#if defined(__debug__) +hb_snprintf( str, sizeof(str), "~MyMainWindow %i %i", (int) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); +#endif hb_itemRelease( block ); destroy(); +#if defined(__debug__) +hb_snprintf( str, sizeof(str), "~MyMainWindow %i %i", (int) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); +#endif } -void MyMainWindow::paintEvent( QPaintEvent * event ) +void MyMainWindow::xpaintEvent( QPaintEvent * event ) { hb_threadMutexLock( s_mutex ); @@ -2260,10 +2270,6 @@ bool MyMainWindow::event( QEvent * event ) { int type = event->type(); //hb_snprintf( str, sizeof( str ), " event(%i) %i", threadID , type ); OutputDebugString( str ); - if( type == QEvent::WindowActivate || type == QEvent::Enter ) - { - activated = true; - } hb_threadMutexLock( s_mutex ); #if 0 if( hb_vmRequestReenter() ) @@ -2292,7 +2298,6 @@ void MyMainWindow::focusInEvent( QFocusEvent *event ) hb_itemRelease( p1 ); hb_vmRequestRestore(); } - activated = true; QWidget::focusInEvent( event ); hb_threadMutexUnlock( s_mutex ); } @@ -2480,4 +2485,55 @@ HB_FUNC( QT_MYDRAWINGAREA ) /*----------------------------------------------------------------------*/ +#if defined(__debug__) + +#include +int hb_getMemUsed( void ) +{ + HANDLE hProcess; + PROCESS_MEMORY_COUNTERS pmc; + int size = 0; + + hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | + PROCESS_VM_READ, + FALSE, GetCurrentProcessId() ); + if (NULL == hProcess) + return 0; + + if ( GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc)) ) + { + #if 0 + printf( "\tPageFaultCount: 0x%08X\n", pmc.PageFaultCount ); + printf( "\tPeakWorkingSetSize: 0x%08X\n", + pmc.PeakWorkingSetSize ); + printf( "\tWorkingSetSize: 0x%08X\n", pmc.WorkingSetSize ); + printf( "\tQuotaPeakPagedPoolUsage: 0x%08X\n", + pmc.QuotaPeakPagedPoolUsage ); + printf( "\tQuotaPagedPoolUsage: 0x%08X\n", + pmc.QuotaPagedPoolUsage ); + printf( "\tQuotaPeakNonPagedPoolUsage: 0x%08X\n", + pmc.QuotaPeakNonPagedPoolUsage ); + printf( "\tQuotaNonPagedPoolUsage: 0x%08X\n", + pmc.QuotaNonPagedPoolUsage ); + printf( "\tPagefileUsage: 0x%08X\n", pmc.PagefileUsage ); + printf( "\tPeakPagefileUsage: 0x%08X\n", + pmc.PeakPagefileUsage ); + #endif + + size = ( int ) pmc.WorkingSetSize / 1024 ; + } + + CloseHandle( hProcess ); + return size; +} +#endif + +HB_FUNC( HB_GETMEMUSED ) +{ +#if defined(__debug__) + hb_retni( hb_getMemUsed() ); +#else + hb_retni( 0 ); +#endif +} #endif diff --git a/harbour/contrib/hbqt/hbqt_slots.h b/harbour/contrib/hbqt/hbqt_slots.h index a13f8e38ba..6370fb56ad 100644 --- a/harbour/contrib/hbqt/hbqt_slots.h +++ b/harbour/contrib/hbqt/hbqt_slots.h @@ -97,16 +97,12 @@ public: void mouseReleaseEvent( QMouseEvent * event ); void wheelEvent( QWheelEvent * event ); void resizeEvent( QResizeEvent * event ); - void paintEvent( QPaintEvent * event ); + void xpaintEvent( QPaintEvent * event ); void focusInEvent( QFocusEvent * event ); void focusOutEvent( QFocusEvent * event ); PHB_ITEM block; int threadID; - bool activated; - QPainter * painter; - - char str[ 50 ]; }; /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/moc_slots.cpp b/harbour/contrib/hbqt/moc_slots.cpp index fc65cbe45d..f5ec59536c 100644 --- a/harbour/contrib/hbqt/moc_slots.cpp +++ b/harbour/contrib/hbqt/moc_slots.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** Meta object code from reading C++ file 'hbqt_slots.h' ** -** Created: Tue Oct 27 23:49:08 2009 -** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2) +** Created: Fri Oct 30 12:46:07 2009 +** by: The Qt Meta Object Compiler version 61 (Qt 4.5.0) ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ @@ -11,7 +11,7 @@ #if !defined(Q_MOC_OUTPUT_REVISION) #error "The header file 'hbqt_slots.h' doesn't include ." #elif Q_MOC_OUTPUT_REVISION != 61 -#error "This file was generated using the moc from 4.5.2. It" +#error "This file was generated using the moc from 4.5.0. It" #error "cannot be used with the include files from this version of Qt." #error "(The moc has changed too much.)" #endif diff --git a/harbour/contrib/hbqt/qtgui/QTableView.cpp b/harbour/contrib/hbqt/qtgui/QTableView.cpp index 86b510a584..cf6686acfb 100644 --- a/harbour/contrib/hbqt/qtgui/QTableView.cpp +++ b/harbour/contrib/hbqt/qtgui/QTableView.cpp @@ -87,10 +87,16 @@ HB_FUNC( QT_HBTABLEVIEW_NAVIGATE ) hb_retptr( new QModelIndex( hbqt_par_HbTableView( 1 )->navigate( hb_parni( 2 ) ) ) ); } +HB_FUNC( QT_HBTABLEVIEW_DESTROY ) +{ + hbqt_par_HbTableView( 1 )->~HbTableView(); +} + + QT_G_FUNC( release_QTableView ) { #if defined(__debug__) - hb_snprintf( str, sizeof(str), "release_QTableView" ); OutputDebugString( str ); +hb_snprintf( str, sizeof(str), "release_QTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); #endif void * ph = ( void * ) Cargo; if( ph ) @@ -104,19 +110,31 @@ QT_G_FUNC( release_QTableView ) else { #if defined(__debug__) - hb_snprintf( str, sizeof(str), " Object Name Missing: QTableView" ); OutputDebugString( str ); +hb_snprintf( str, sizeof(str), " Object Name Missing: QTableView" ); OutputDebugString( str ); #endif } } + else + { +#if defined(__debug__) +hb_snprintf( str, sizeof(str), "! ph____QTableView" ); OutputDebugString( str ); +#endif + } } HB_FUNC( QT_QTABLEVIEW ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), gcFuncs() ); QPointer< QTableView > pObj = NULL; +#if defined(__debug__) +hb_snprintf( str, sizeof(str), " GC: new QTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); +#endif pObj = ( QTableView* ) new QTableView( hbqt_par_QWidget( 1 ) ) ; +#if defined(__debug__) +hb_snprintf( str, sizeof(str), " GC: %i B %i KB", ( int ) hb_xquery( 1001 ), hb_getMemUsed() ); OutputDebugString( str ); +#endif p->ph = pObj; p->func = release_QTableView; diff --git a/harbour/contrib/hbqt/qtgui/TQTableView.prg b/harbour/contrib/hbqt/qtgui/TQTableView.prg index d8e0803cc6..e71a51c420 100644 --- a/harbour/contrib/hbqt/qtgui/TQTableView.prg +++ b/harbour/contrib/hbqt/qtgui/TQTableView.prg @@ -304,6 +304,7 @@ CREATE CLASS HBTableView INHERIT QTableView METHOD new( pParent ) METHOD navigate( nCursorAction, nModifiers ) + METHOD destroy() ENDCLASS @@ -314,4 +315,7 @@ METHOD HBTableView:new( pParent ) METHOD HBTableView:navigate( nCursorAction, nModifiers ) RETURN Qt_HbTableView_navigate( ::pPtr, nCursorAction, nModifiers ) +METHOD HBTableView:destroy() + RETURN Qt_HbTableView_destroy( ::pPtr ) + diff --git a/harbour/contrib/hbqt/qth/QTableView.qth b/harbour/contrib/hbqt/qth/QTableView.qth index 6b05299fbf..b135cee95b 100644 --- a/harbour/contrib/hbqt/qth/QTableView.qth +++ b/harbour/contrib/hbqt/qth/QTableView.qth @@ -64,6 +64,7 @@ CREATE CLASS HBTableView INHERIT QTableView METHOD new( pParent ) METHOD navigate( nCursorAction, nModifiers ) + METHOD destroy() ENDCLASS @@ -74,6 +75,9 @@ METHOD HBTableView:new( pParent ) METHOD HBTableView:navigate( nCursorAction, nModifiers ) RETURN Qt_HbTableView_navigate( ::pPtr, nCursorAction, nModifiers ) +METHOD HBTableView:destroy() + RETURN Qt_HbTableView_destroy( ::pPtr ) + @@ -99,6 +103,12 @@ HB_FUNC( QT_HBTABLEVIEW_NAVIGATE ) { hb_retptr( new QModelIndex( hbqt_par_HbTableView( 1 )->navigate( hb_parni( 2 ) ) ) ); } + +HB_FUNC( QT_HBTABLEVIEW_DESTROY ) +{ + hbqt_par_HbTableView( 1 )->~HbTableView(); +} + diff --git a/harbour/contrib/hbxbp/tests/demoxbp.prg b/harbour/contrib/hbxbp/tests/demoxbp.prg index 9019a6c9ba..341b9cbc41 100644 --- a/harbour/contrib/hbxbp/tests/demoxbp.prg +++ b/harbour/contrib/hbxbp/tests/demoxbp.prg @@ -113,9 +113,11 @@ PROCEDURE BuildADialog() LOCAL nThread := ThreadID() //LOCAL oStat, aMenu, aTool, aBrow, aChek, a3Sta + +xbp_debug( nThread, " At Startup of Thread ", memory( 1001 ) ) /* Create Application Window */ oDlg := GuiStdDialog( "Harbour - Xbase++ - QT Dialog [ "+ hb_ntos( nThread )+" ]" ) - +xbp_debug( nThread, " oDlg := GuiStdDialog ", memory( 1001 ) ) oDlg:close := {|| MsgBox( "You can also close me by pressing [ESC]" ), .T. } // oDlg:killDisplayFocus := {|| hb_OutDebug( "Loosing Display Focus" ) } SetAppWindow( oDlg ) @@ -139,61 +141,61 @@ PROCEDURE BuildADialog() /* Install menu system */ Build_MenuBar( oDlg ) - +xbp_debug( nThread, " Build_MenuBar ", memory( 1001 ) ) /* Install Statusbar */ Build_StatusBar( oDa ) - +xbp_debug( nThread, " Build_StatusBar ", memory( 1001 ) ) /* Install Toolbar */ Build_ToolBar( oDa ) - +xbp_debug( nThread, " Build_ToolBar ", memory( 1001 ) ) /* Install Tab Pages */ aTabs := Build_TabPages( oDa ) - +xbp_debug( nThread, " Build_TabPages ", memory( 1001 ) ) /* Build XBPBrowse() */ Build_Browse( aTabs[ TAB_1 ] ) - +xbp_debug( nThread, " Build_Browse ", memory( 1001 ) ) /* Install Multi-Line Edit */ oMLE := Build_MLE( aTabs[ TAB_2 ] ) - +xbp_debug( nThread, " Build_MLE ", memory( 1001 ) ) /* Install checkboxes */ Build_CheckBox( aTabs[ TAB_3 ] ) - +xbp_debug( nThread, " Build_CheckBox ", memory( 1001 ) ) /* Install 3state checkboxes */ Build_3State( aTabs[ TAB_3 ] ) - +xbp_debug( nThread, " Build_3State ", memory( 1001 ) ) /* Install Radio Buttons */ Build_RadioButton( aTabs[ TAB_3 ] ) - +xbp_debug( nThread, " Build_RadioButton", memory( 1001 ) ) /* Install Spin Buttons */ Build_SpinButtons( aTabs[ TAB_3 ] ) - +xbp_debug( nThread, " Build_SpinButton ", memory( 1001 ) ) /* Install TreeView */ Build_TreeView( aTabs[ TAB_4 ] ) - +xbp_debug( nThread, " Build_TreeView ", memory( 1001 ) ) /* Install ListBox */ Build_ListBox( aTabs[ TAB_5 ] ) - +xbp_debug( nThread, " Build_ListBox ", memory( 1001 ) ) /* Install Combo Box */ Build_ComboBox( aTabs[ TAB_5 ] ) - +xbp_debug( nThread, " Build_ComboBox ", memory( 1001 ) ) /* Install Push Buttons */ Build_PushButton( aTabs[ TAB_5 ] ) - +xbp_debug( nThread, " Build_PushButton ", memory( 1001 ) ) /* Install Single Line Edits */ Build_SLEs( aTabs[ TAB_5 ] ) - +xbp_debug( nThread, " Build_SLEs ", memory( 1001 ) ) /* Install ScrollBar */ Build_ScrollBar( aTabs[ TAB_5 ] ) - +xbp_debug( nThread, " Build_ScrollBars ", memory( 1001 ) ) /* Build RTF */ Build_Rtf( aTabs[ TAB_6 ] ) - +xbp_debug( nThread, " Build_Rtf ", memory( 1001 ) ) /* Build HTML Viewer */ oHTM := Build_HTMLViewer( aTabs[ TAB_7 ] ) - +xbp_debug( nThread, " Build_HTMLViewer ", memory( 1001 ) ) /* Build Statics */ Build_Statics( aTabs[ TAB_8 ] ) - +xbp_debug( nThread, " Build_Statics ", memory( 1001 ), hb_getMemUsed() ) /* Present the dialog on the screen */ oDlg:Show() @@ -218,9 +220,11 @@ xbp_debug( ".............................. WOW ................................. xbp_debug( "------------------------------ WOW ---------------------------------" ) xbp_debug( ". " ) - oHTM := NIL - oMLE := NIL - //oDlg := NIL +// oHTM := NIL +// oMLE := NIL +// oDlg := NIL +// hb_gcAll( .t. ) +xbp_debug( nThread, " THE END ", memory( 1001 ), hb_getMemUsed() ) RETURN /*----------------------------------------------------------------------*/ @@ -1610,7 +1614,7 @@ FUNCTION Build_Browse( oWnd ) #endif DbGotop() - oXbpBrowse := XbpBrowse():new():create( oWnd, , { 10,10 }, { oWnd:currentSize()[1]-25,oWnd:currentSize()[2]-45 } ) + oXbpBrowse := XbpBrowse():new():create( oWnd, , { 10,10 }, { oWnd:currentSize()[1]-20,oWnd:currentSize()[2]-20 } ) oXbpBrowse:setFontCompoundName( "10.Courier" ) //oXbpBrowse:hScroll := .f. // OK //oXbpBrowse:vScroll := .f. // OK diff --git a/harbour/contrib/hbxbp/xbpbrowse.prg b/harbour/contrib/hbxbp/xbpbrowse.prg index 9f33553c96..5cde180344 100644 --- a/harbour/contrib/hbxbp/xbpbrowse.prg +++ b/harbour/contrib/hbxbp/xbpbrowse.prg @@ -724,20 +724,20 @@ METHOD XbpBrowse:destroy() ::oHScrollBar:pPtr := 0 ::oVScrollBar:pPtr := 0 - //::oLeftView:destroy() + ::oLeftView:destroy() ::oLeftDbfModel:destroy() ::oLeftVHeaderView:pPtr := 0 ::oLeftHeaderView:pPtr := 0 ::oLeftFooterView:pPtr := 0 ::oLeftFooterModel:destroy() - //::oRightView:destroy() + ::oRightView:destroy() ::oRightHeaderView:pPtr := 0 ::oRightDbfModel:destroy() ::oRightFooterView:pPtr := 0 ::oRightFooterModel:destroy() - //::oTableView:destroy() + ::oTableView:destroy() ::oVHeaderView:pPtr := 0 ::oDbfModel:destroy() diff --git a/harbour/contrib/hbxbp/xbpdialog.prg b/harbour/contrib/hbxbp/xbpdialog.prg index a7f4614d6a..e023215835 100644 --- a/harbour/contrib/hbxbp/xbpdialog.prg +++ b/harbour/contrib/hbxbp/xbpdialog.prg @@ -124,9 +124,13 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::cargo := ThreadID() /* To Be Removed */ - //::oWidget := QMainWindow():new() + #define __xQMAINWINDOW__ + // + #ifdef __QMAINWINDOW__ + ::oWidget := QMainWindow():new() + #else ::oWidget := QMainWindow():configure( QT_MyMainWindow( {|n,p| ::grabEvent( n,p ) }, ThreadID() ) ) - //::oWidget:setAttribute( Qt_WA_DeleteOnClose ) + #endif //::oWidget:setMouseTracking( .t. ) IF !empty( ::title ) @@ -162,7 +166,9 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) /* Instal Event Filter */ ::oWidget:installEventFilter( SetEventFilter() ) + #ifdef __QMAINWINDOW__ ::connectWindowEvents() + #endif ::connectEvent( ::pWidget, QEvent_Close , {|o,e| ::exeBlock( QEvent_Close , e, o ) } ) ::connectEvent( ::pWidget, QEvent_WindowActivate , {|o,e| ::exeBlock( QEvent_WindowActivate , e, o ) } ) @@ -228,6 +234,8 @@ METHOD XbpDialog:destroy() ::oWidget := NIL Self := NIL + ClearEventBuffer() + RETURN nil /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbxbp/xbpgeneric.prg b/harbour/contrib/hbxbp/xbpgeneric.prg index b18f29d028..0d295811e6 100644 --- a/harbour/contrib/hbxbp/xbpgeneric.prg +++ b/harbour/contrib/hbxbp/xbpgeneric.prg @@ -138,6 +138,17 @@ FUNCTION InitializeEventBuffer() /*----------------------------------------------------------------------*/ +FUNCTION ClearEventBuffer() + + IF !empty( ts_events ) + aeval( ts_events, {|e,i| e := e, ts_events[ i ] := NIL } ) + ts_events := NIL + ENDIF + + RETURN nil + +/*----------------------------------------------------------------------*/ + FUNCTION SetEventFilter() RETURN QT_QEventFilter() diff --git a/harbour/contrib/hbxbp/xbpmenubar.prg b/harbour/contrib/hbxbp/xbpmenubar.prg index f6b3be4916..d78f28cfca 100644 --- a/harbour/contrib/hbxbp/xbpmenubar.prg +++ b/harbour/contrib/hbxbp/xbpmenubar.prg @@ -231,9 +231,20 @@ METHOD xbpMenuBar:destroy() ENDIF NEXT + ::sl_beginMenu := NIL + ::sl_endMenu := NIL + ::sl_itemMarked := NIL + ::sl_itemSelected := NIL + ::sl_drawItem := NIL + ::sl_measureItem := NIL + ::sl_onMenuKey := NIL + + ::aMenuItems := {} + ::aOrgItems := {} + ::xbpWindow:destroy() - RETURN .T. + RETURN NIL /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbxbp/xbpwindow.prg b/harbour/contrib/hbxbp/xbpwindow.prg index 1582ec9d41..57296fad94 100644 --- a/harbour/contrib/hbxbp/xbpwindow.prg +++ b/harbour/contrib/hbxbp/xbpwindow.prg @@ -715,17 +715,16 @@ xbp_Debug( memory( 1001 ),"Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty( ::aChildren := {} ENDIF + ::XbpPartHandler:destroy() + ::clearSlots() + IF cXbp != "XBPDIALOG" ::oWidget:pPtr := 0 ::oWidget := NIL ENDIF - ::XbpPartHandler:destroy() - ::clearSlots() xbp_Debug( memory( 1001 )," Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ) ) -// Self := NIL - RETURN NIL /*----------------------------------------------------------------------*/