From 70fa1debb044f87bd5aa457601c308250dfab543 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 15 May 2012 07:07:01 +0000 Subject: [PATCH] 2012-05-15 00:01 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/hbmk2_qt.hb * contrib/hbqt/qtcore/hbqtcore.h * contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp * contrib/hbqt/qtgui/hbqtgui.h - Removed: the usage of HBQT_TYPE_xxxx constants. It was a hack to identify a few type of objects Qt had not provided the mechanism to retrieve. NOTE: there should be improvement in build speed of hbQT. * contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp - Added: deletion of child widget of HBQPlainTextEdit. --- harbour/ChangeLog | 13 +++++++ harbour/contrib/hbqt/hbmk2_qt.hb | 6 ---- harbour/contrib/hbqt/qtcore/hbqtcore.h | 2 -- .../hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp | 34 +++++++++--------- .../hbqt/qtgui/hbqt_hbqplaintextedit.cpp | 35 +++++++++---------- harbour/contrib/hbqt/qtgui/hbqtgui.h | 16 --------- 6 files changed, 45 insertions(+), 61 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c305d8d9dc..cb0c9c22b0 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,19 @@ The license applies to all entries newer than 2009-04-28. */ +2012-05-15 00:01 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/hbmk2_qt.hb + * contrib/hbqt/qtcore/hbqtcore.h + * contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp + * contrib/hbqt/qtgui/hbqtgui.h + - Removed: the usage of HBQT_TYPE_xxxx constants. + It was a hack to identify a few type of objects Qt had + not provided the mechanism to retrieve. + NOTE: there should be improvement in build speed of hbQT. + + * contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp + - Added: deletion of child widget of HBQPlainTextEdit. + 2012-05-13 16:46 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/hbmk2_qt.hb - Removed: #define __GCMARK__ diff --git a/harbour/contrib/hbqt/hbmk2_qt.hb b/harbour/contrib/hbqt/hbmk2_qt.hb index 62a9e73894..a5288e7a61 100644 --- a/harbour/contrib/hbqt/hbmk2_qt.hb +++ b/harbour/contrib/hbqt/hbmk2_qt.hb @@ -1463,10 +1463,6 @@ METHOD HbQtSource:build() AAdd( aLine, "#endif" ) ENDIF AAdd( aLine, "" ) - FOR EACH s IN ::hRef - AAdd( aLine, PadR( "#define HBQT_TYPE_" + s:__enumKey(), 64 ) + "( ( HB_U32 ) 0x" + hb_NumToHex( hb_crc32( "HBQT_TYPE_" + s:__enumKey() ), 8 ) + " )" ) - NEXT - AAdd( aLine, "" ) /*----------------------------------------------------------------------*/ /* Insert user defined code - INCLUDEs */ @@ -1507,7 +1503,6 @@ METHOD HbQtSource:build() ENDIF AAdd( aLine, " bool bNew;" ) AAdd( aLine, " PHBQT_GC_FUNC func;" ) - AAdd( aLine, " HB_U32 type;" ) AAdd( aLine, " PHBQT_GC_FUNC mark;" ) AAdd( aLine, "} HBQT_GC_T_" + ::cQtObject + ";" ) AAdd( aLine, " " ) @@ -1634,7 +1629,6 @@ METHOD HbQtSource:build() ENDIF AAdd( aLine, " p->bNew = bNew;" ) AAdd( aLine, " p->func = hbqt_gcRelease_" + ::cQtObject + ";" ) - AAdd( aLine, " p->type = HBQT_TYPE_" + ::cQtObject + ";" ) if n > 0 AAdd( aLine, " p->mark = hbqt_gcMark_" + ::cQtObject + ";" ) else diff --git a/harbour/contrib/hbqt/qtcore/hbqtcore.h b/harbour/contrib/hbqt/qtcore/hbqtcore.h index 92d6236fc4..c9f6267d26 100644 --- a/harbour/contrib/hbqt/qtcore/hbqtcore.h +++ b/harbour/contrib/hbqt/qtcore/hbqtcore.h @@ -23,6 +23,4 @@ HB_EXTERN_END #define hbqt_par_HBQSlots( n ) ( ( HBQSlots * ) hbqt_par_ptr( n ) ) #define hbqt_par_HBQString( n ) ( ( HBQString * ) hbqt_par_ptr( n ) ) -#define HBQT_TYPE_QSize ( ( HB_U32 ) 0xD1575132 ) - #endif /* __HBQTCORE_H */ diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp index ea6a1664a2..6ac087947c 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp @@ -55,6 +55,7 @@ #include "hbapiitm.h" #include "hbvm.h" +#include "hbapicls.h" #if QT_VERSION >= 0x040500 @@ -78,7 +79,7 @@ QVariant hbqt_fetchData( PHB_ITEM block, int type, int role, int par1, int par2 PHB_ITEM p2 = hb_itemPutNI( NULL, par1 ); PHB_ITEM p3 = hb_itemPutNI( NULL, par2 ); - PHB_ITEM ret = hb_vmEvalBlockV( block, 4, p0, p1, p2, p3 ); + PHB_ITEM ret = hb_itemNew( hb_vmEvalBlockV( block, 4, p0, p1, p2, p3 ) ); hb_itemRelease( p0 ); hb_itemRelease( p1 ); @@ -109,26 +110,23 @@ QVariant hbqt_fetchData( PHB_ITEM block, int type, int role, int par1, int par2 } else if( hb_itemType( ret ) & HB_IT_OBJECT ) { - hb_vmPushSymbol( hb_dynsymSymbol( hb_dynsymFindName( "PPTR" ) ) ); - hb_vmPush( ret ); - hb_vmSend( 0 ); + void * p = hbqt_get_ptr( ret ); - HBQT_GC_T * p = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), -1 ); - - if( p->type == HBQT_TYPE_QBrush ) - vv = * ( ( QBrush * ) ( p->ph ) ); - else if( p->type == HBQT_TYPE_QColor ) - vv = * ( ( QColor * ) ( p->ph ) ); - else if( p->type == HBQT_TYPE_QSize ) - vv = * ( ( QSize * ) ( p->ph ) ); - else if( p->type == HBQT_TYPE_QIcon ) - vv = * ( ( QIcon * ) ( p->ph ) ); - else if( p->type == HBQT_TYPE_QPixmap ) - vv = * ( ( QPixmap * ) ( p->ph ) ); - else if( p->type == HBQT_TYPE_QFont ) - vv = * ( ( QFont * ) ( p->ph ) ); + if( hbqt_obj_isDerivedFrom( ret, "QBRUSH" ) ) + vv = * ( ( QBrush * ) ( p ) ); + else if( hbqt_obj_isDerivedFrom( ret, "QCOLOR" ) ) + vv = * ( ( QColor * ) ( p ) ); + else if( hbqt_obj_isDerivedFrom( ret, "QICON" ) ) + vv = * ( ( QIcon * ) ( p ) ); + else if( hbqt_obj_isDerivedFrom( ret, "QSIZE" ) ) + vv = * ( ( QSize * ) ( p ) ); + else if( hbqt_obj_isDerivedFrom( ret, "QFONT" ) ) + vv = * ( ( QFont * ) ( p ) ); + else if( hbqt_obj_isDerivedFrom( ret, "QPIXMAP" ) ) + vv = * ( ( QPixmap * ) ( p ) ); } + hb_itemRelease( ret ); hb_vmRequestRestore(); } diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp index 6f3f24ddf3..83b942b4fd 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp @@ -192,6 +192,22 @@ HBQPlainTextEdit::HBQPlainTextEdit( QWidget * parent ) : QPlainTextEdit( parent /*----------------------------------------------------------------------*/ +HBQPlainTextEdit::~HBQPlainTextEdit() +{ + #if 0 + if( timer ) + timer->stop(); + #endif + + delete lineNumberArea; + delete horzRuler; + + if( block ) + hb_itemRelease( block ); +} + +/*----------------------------------------------------------------------*/ + void HBQPlainTextEdit::hbShowPrototype( const QString & tip, int rows, int cols ) { if( ! isCompletionTipsActive ){ @@ -250,25 +266,6 @@ void HBQPlainTextEdit::hbShowPrototype( const QString & tip, int rows, int cols /*----------------------------------------------------------------------*/ -HBQPlainTextEdit::~HBQPlainTextEdit() -{ - #if 0 - if( timer ) - timer->stop(); - #endif -#if 0 - disconnect( this, SIGNAL( blockCountChanged( int ) ) ); - disconnect( this, SIGNAL( updateRequest( const QRect &, int ) ) ); - disconnect( this, SIGNAL( cursorPositionChanged() ) ); -#endif - delete lineNumberArea; - - if( block ) - hb_itemRelease( block ); -} - -/*----------------------------------------------------------------------*/ - void HBQPlainTextEdit::hbSetEventBlock( PHB_ITEM pBlock ) { if( pBlock ) diff --git a/harbour/contrib/hbqt/qtgui/hbqtgui.h b/harbour/contrib/hbqt/qtgui/hbqtgui.h index d063cb8c5f..5808f927c8 100644 --- a/harbour/contrib/hbqt/qtgui/hbqtgui.h +++ b/harbour/contrib/hbqt/qtgui/hbqtgui.h @@ -29,20 +29,4 @@ HB_EXTERN_END #define hbqt_par_QPrinter( n ) ( ( QPrinter * ) hbqt_par_ptr( n ) ) #define hbqt_par_QWidget( n ) ( ( QWidget * ) hbqt_par_ptr( n ) ) -#define HBQT_TYPE_QBrush ( ( HB_U32 ) 0x94319C70 ) -#define HBQT_TYPE_QColor ( ( HB_U32 ) 0x03C0065A ) -#define HBQT_TYPE_QFont ( ( HB_U32 ) 0xF6037D8A ) -#define HBQT_TYPE_QGradient ( ( HB_U32 ) 0x7F4BEC23 ) -#define HBQT_TYPE_QMatrix ( ( HB_U32 ) 0xAA3E35B7 ) -#define HBQT_TYPE_QImage ( ( HB_U32 ) 0xA0AB4AEC ) -#define HBQT_TYPE_QBitmap ( ( HB_U32 ) 0xBA602AD4 ) -#define HBQT_TYPE_QBoxLayout ( ( HB_U32 ) 0xA184A755 ) - -#ifndef HBQT_TYPE_QIcon -#define HBQT_TYPE_QIcon ( ( HB_U32 ) 0x43035C83 ) -#endif -#ifndef HBQT_TYPE_QPixmap -#define HBQT_TYPE_QPixmap ( ( HB_U32 ) 0xBEA836FC ) -#endif - #endif /* __HBQTGUI_H */