2012-05-11 18:45 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/idefunctions.prg
* contrib/hbide/ideharbourhelp.prg
* contrib/hbide/idemain.prg
* contrib/hbide/idemisc.prg
* contrib/hbide/ideshortcuts.prg
* Optimized: to avoid repeated QApplication() object creation
and destruction.
* contrib/hbqt/qtcore/hbqt_hbqslots.cpp
* contrib/hbqt/qtcore/hbqt_misc.prg
* contrib/hbqt/qtcore/hbqt_pointer.cpp
* Changed: the way :connect()/disConnect() could been
applied to an object. Now programmer cannot make
a mistake, controlling one more pitfall.
* contrib/hbqt/qtcore/qth/QUrl.qth
* contrib/hbqt/qtgui/qth/QListWidgetItem.qth
- Inherits = QObject
* contrib/hbqt/qtgui/qth/QWidget.qth
- PainEvent = YES
; NOTE: still "Reference to freed block" messages at EXIT
are unresolved and very much reproducable.
This commit is contained in:
@@ -16,6 +16,32 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-05-11 18:45 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbide/idefunctions.prg
|
||||
* contrib/hbide/ideharbourhelp.prg
|
||||
* contrib/hbide/idemain.prg
|
||||
* contrib/hbide/idemisc.prg
|
||||
* contrib/hbide/ideshortcuts.prg
|
||||
* Optimized: to avoid repeated QApplication() object creation
|
||||
and destruction.
|
||||
|
||||
* contrib/hbqt/qtcore/hbqt_hbqslots.cpp
|
||||
* contrib/hbqt/qtcore/hbqt_misc.prg
|
||||
* contrib/hbqt/qtcore/hbqt_pointer.cpp
|
||||
* Changed: the way :connect()/disConnect() could been
|
||||
applied to an object. Now programmer cannot make
|
||||
a mistake, controlling one more pitfall.
|
||||
|
||||
* contrib/hbqt/qtcore/qth/QUrl.qth
|
||||
* contrib/hbqt/qtgui/qth/QListWidgetItem.qth
|
||||
- Inherits = QObject
|
||||
|
||||
* contrib/hbqt/qtgui/qth/QWidget.qth
|
||||
- PainEvent = YES
|
||||
|
||||
; NOTE: still "Reference to freed block" messages at EXIT
|
||||
are unresolved and very much reproducable.
|
||||
|
||||
2012-05-11 01:45 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbqt/hbmk2_qt.hb
|
||||
+ Applied: concept forwarded by Francessco a few days back,
|
||||
|
||||
@@ -440,6 +440,7 @@ METHOD IdeFunctions:enableControls( lEnable )
|
||||
METHOD IdeFunctions:loadTags( aProjects )
|
||||
LOCAL cProjectTitle, cProjFile, cTagFile, aTags, n, a_
|
||||
LOCAL lPopulate := .f.
|
||||
LOCAL qApp := QApplication()
|
||||
|
||||
DEFAULT aProjects TO ::getMarkedProjects()
|
||||
|
||||
@@ -468,7 +469,7 @@ METHOD IdeFunctions:loadTags( aProjects )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
QApplication():processEvents()
|
||||
qApp:processEvents()
|
||||
IF ::lQuitting
|
||||
EXIT
|
||||
ENDIF
|
||||
@@ -508,6 +509,7 @@ METHOD IdeFunctions:tagProject( cProjectTitle )
|
||||
LOCAL aSumData := ""
|
||||
LOCAL cComments, aSummary, cPath, cSource, cExt, aTags, aText, aFuncList, aLines
|
||||
LOCAL cProjFile, cRoot, aCTags, aSources, cSrc, a_, n
|
||||
LOCAL qApp := QApplication()
|
||||
|
||||
IF !( ::inAction )
|
||||
::enableControls( .f. )
|
||||
@@ -541,7 +543,7 @@ METHOD IdeFunctions:tagProject( cProjectTitle )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
QApplication():processEvents()
|
||||
qApp:processEvents()
|
||||
IF ::lQuitting
|
||||
EXIT
|
||||
ENDIF
|
||||
@@ -603,6 +605,7 @@ METHOD IdeFunctions:consolidateList()
|
||||
|
||||
METHOD IdeFunctions:populateTable()
|
||||
LOCAL oTbl, qItm, a_, n
|
||||
LOCAL qApp := QApplication()
|
||||
|
||||
::clear( .t. )
|
||||
::buildHeader()
|
||||
@@ -619,7 +622,7 @@ METHOD IdeFunctions:populateTable()
|
||||
oTbl:setItem( n, 0, qItm )
|
||||
oTbl:setRowHeight( n, 16 )
|
||||
|
||||
QApplication():processEvents()
|
||||
qApp:processEvents()
|
||||
IF ::lQuitting
|
||||
EXIT
|
||||
ENDIF
|
||||
|
||||
@@ -1422,7 +1422,8 @@ METHOD IdeHarbourHelp:exportAsPdf()
|
||||
|
||||
METHOD IdeHarbourHelp:exportAsPdfAll()
|
||||
LOCAL cPdf, qPrinter, cExt, cPath, cFile, aItems
|
||||
|
||||
LOCAL qApp := QApplication()
|
||||
|
||||
IF empty( ::aNodes )
|
||||
RETURN Self
|
||||
ENDIF
|
||||
@@ -1433,7 +1434,7 @@ METHOD IdeHarbourHelp:exportAsPdfAll()
|
||||
|
||||
FOR EACH aItems IN ::aNodes
|
||||
::oUI:q_treeDoc:setCurrentItem( aItems[ 1 ], 0 )
|
||||
QApplication():processEvents()
|
||||
qApp:processEvents()
|
||||
IF ::lQuitting
|
||||
EXIT
|
||||
ENDIF
|
||||
|
||||
@@ -140,10 +140,8 @@ FUNCTION Main( ... )
|
||||
#if 0
|
||||
oTmp:create()
|
||||
oTmp:destroy()
|
||||
oTmp := NIL
|
||||
#else
|
||||
oTmp:create()
|
||||
oTmp := NIL
|
||||
#endif
|
||||
|
||||
RETURN NIL
|
||||
|
||||
@@ -245,8 +245,6 @@ FUNCTION hbide_getYesNo( cMsg, cInfo, cTitle )
|
||||
oMB:setInformativeText( cInfo )
|
||||
ENDIF
|
||||
oMB:setIcon( QMessageBox_Information )
|
||||
oMB:setParent( SetAppWindow():oWidget )
|
||||
oMB:setWindowFlags( Qt_Dialog )
|
||||
oMB:setWindowTitle( cTitle )
|
||||
oMB:setStandardButtons( QMessageBox_Yes + QMessageBox_No )
|
||||
|
||||
|
||||
@@ -649,6 +649,7 @@ METHOD IdeShortcuts:clearDftSCuts()
|
||||
METHOD IdeShortcuts:populateDftSCuts()
|
||||
LOCAL a_, nRow
|
||||
LOCAL oTbl := ::oUI:q_tableMacros
|
||||
LOCAL qApp := QApplication()
|
||||
|
||||
oTbl:setRowCount( len( ::aDftSCuts ) )
|
||||
|
||||
@@ -657,7 +658,7 @@ METHOD IdeShortcuts:populateDftSCuts()
|
||||
nRow++
|
||||
aadd( ::aDftSCutsItms, array( 6 ) )
|
||||
::array2table( nRow, a_ )
|
||||
QApplication():processEvents()
|
||||
qApp:processEvents()
|
||||
IF ::lQuitting
|
||||
EXIT
|
||||
ENDIF
|
||||
|
||||
@@ -117,15 +117,17 @@ HBQSlots::HBQSlots( PHB_ITEM pObj ) : QObject()
|
||||
HBQSlots::~HBQSlots()
|
||||
{
|
||||
int i;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "Destroying: HBQSlots Size = %i", listBlock.size() ) );
|
||||
for( i = listBlock.size() - 1; i >= 0 ; i-- )
|
||||
{
|
||||
if( listBlock[ i ] != NULL )
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "HBQSlots::~HBQSlots() item %d", i ) );
|
||||
hb_itemRelease( listBlock.at( i ) );
|
||||
listBlock[ i ] = NULL;
|
||||
}
|
||||
}
|
||||
listBlock.clear();
|
||||
}
|
||||
|
||||
int HBQSlots::hbConnect( PHB_ITEM pObj, char * pszSignal, PHB_ITEM bBlock )
|
||||
@@ -226,7 +228,10 @@ int HBQSlots::hbDisconnect( PHB_ITEM pObj, char * pszSignal )
|
||||
if( signalId != -1 )
|
||||
{
|
||||
if( QMetaObject::disconnect( object, signalId, 0, 0 ) )
|
||||
{
|
||||
HB_TRACE( HB_TR_DEBUG, ( "HBQSlots::hbDisconnect( %s )", pszSignal ) );
|
||||
nResult = 0;
|
||||
}
|
||||
else
|
||||
nResult = 5;
|
||||
}
|
||||
|
||||
@@ -62,18 +62,20 @@ CREATE CLASS HbQtObjectHandler
|
||||
|
||||
VAR pPtr /* TODO: Rename to __pPtr */
|
||||
|
||||
VAR __pSlots PROTECTED
|
||||
VAR __pEvents PROTECTED
|
||||
VAR __pSlots PROTECTED
|
||||
VAR __pEvents PROTECTED
|
||||
|
||||
VAR hEvents INIT {=>}
|
||||
|
||||
METHOD hasValidPointer()
|
||||
|
||||
METHOD connect( cnEvent, bBlock )
|
||||
METHOD disconnect( cnEvent )
|
||||
|
||||
DESTRUCTOR _destroy()
|
||||
|
||||
ERROR HANDLER onError()
|
||||
|
||||
ENDCLASS
|
||||
ENDCLASS
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -112,13 +114,25 @@ METHOD HbQtObjectHandler:onError()
|
||||
METHOD HbQtObjectHandler:connect( cnEvent, bBlock )
|
||||
LOCAL nResult
|
||||
|
||||
IF ! __objDerivedFrom( Self, "QOBJECT" )
|
||||
RETURN .f.
|
||||
ENDIF
|
||||
|
||||
IF ! hb_isBlock( bBlock )
|
||||
RETURN .f.
|
||||
ENDIF
|
||||
|
||||
IF hb_hHasKey( ::hEvents, cnEvent )
|
||||
IF hb_isNumeric( ::hEvents[ cnEvent ] )
|
||||
::__pEvents:hbDisconnect( Self, cnEvent )
|
||||
ELSE
|
||||
::__pSlots:hbDisconnect( Self, cnEvent )
|
||||
ENDIF
|
||||
::hEvents[ cnEvent ] := NIL
|
||||
ENDIF
|
||||
|
||||
SWITCH ValType( cnEvent )
|
||||
CASE "C"
|
||||
|
||||
IF Empty( ::__pSlots )
|
||||
::__pSlots := HBQSlots( Self )
|
||||
ENDIF
|
||||
@@ -126,6 +140,7 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock )
|
||||
|
||||
SWITCH nResult
|
||||
CASE 0
|
||||
::hEvents[ cnEvent ] := cnEvent
|
||||
RETURN .T.
|
||||
CASE 8 /* QT connect call failure */
|
||||
RETURN .F.
|
||||
@@ -148,6 +163,7 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock )
|
||||
|
||||
SWITCH nResult
|
||||
CASE 0
|
||||
::hEvents[ cnEvent ] := cnEvent
|
||||
RETURN .T.
|
||||
CASE -3 /* bBlock not supplied */
|
||||
RETURN .F.
|
||||
@@ -157,27 +173,36 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock )
|
||||
|
||||
OTHERWISE
|
||||
nResult := 99
|
||||
|
||||
ENDSWITCH
|
||||
|
||||
__hbqt_error( 1200 + nResult )
|
||||
|
||||
RETURN .F.
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD HbQtObjectHandler:disconnect( cnEvent )
|
||||
|
||||
LOCAL nResult := 0
|
||||
|
||||
IF ! __objDerivedFrom( Self, "QOBJECT" )
|
||||
RETURN .f.
|
||||
ENDIF
|
||||
|
||||
IF ! hb_hHasKey( ::hEvents, cnEvent )
|
||||
RETURN .f.
|
||||
ENDIF
|
||||
|
||||
SWITCH ValType( cnEvent )
|
||||
CASE "C"
|
||||
IF ! empty( ::__pSlots )
|
||||
nResult := ::__pSlots:hbdisconnect( Self, cnEvent )
|
||||
nResult := ::__pSlots:hbDisconnect( Self, cnEvent )
|
||||
ENDIF
|
||||
|
||||
SWITCH nResult
|
||||
CASE 0
|
||||
CASE 4 /* signal not found in object */
|
||||
CASE 5 /* disconnect failure */
|
||||
::hEvents[ cnEvent ] := NIL
|
||||
RETURN .T.
|
||||
CASE 1 /* wrong slot container, no connect was called yet */
|
||||
CASE 2 /* object has been already freed */
|
||||
@@ -193,6 +218,7 @@ METHOD HbQtObjectHandler:disconnect( cnEvent )
|
||||
|
||||
SWITCH nResult
|
||||
CASE 0
|
||||
::hEvents[ cnEvent ] := NIL
|
||||
RETURN .T.
|
||||
CASE -3 /* event not found */
|
||||
CASE -2 /* event not found */
|
||||
@@ -203,6 +229,7 @@ METHOD HbQtObjectHandler:disconnect( cnEvent )
|
||||
|
||||
OTHERWISE
|
||||
nResult := 99
|
||||
|
||||
ENDSWITCH
|
||||
|
||||
__hbqt_error( 1300 + nResult )
|
||||
@@ -211,14 +238,31 @@ METHOD HbQtObjectHandler:disconnect( cnEvent )
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD HbQtObjectHandler:_destroy()
|
||||
LOCAL cnEvent
|
||||
|
||||
IF __objDerivedFrom( Self, "HB_OBJECT" )
|
||||
::disconnect()
|
||||
ENDIF
|
||||
|
||||
IF ! __objDerivedFrom( Self, "QOBJECT" )
|
||||
RETURN NIL
|
||||
ENDIF
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, " _destroy()", __objDerivedFrom( Self, "QOBJECT" ), "pSlots", valtype( ::__pSlots ), "pEvents", valtype( ::__pEvents ) )
|
||||
|
||||
FOR EACH cnEvent IN ::hEvents
|
||||
IF hb_isNumeric( cnEvent ) .AND. ! empty( ::__pEvents )
|
||||
HB_TRACE( HB_TR_DEBUG, " _destroy()", "N", cnEvent )
|
||||
::__pEvents:hbDisconnect( Self, cnEvent )
|
||||
ELSEIF hb_isChar( cnEvent ) .AND. ! empty( ::__pSlots )
|
||||
HB_TRACE( HB_TR_DEBUG, " _destroy()", "C", cnEvent )
|
||||
::__pSlots:hbDisconnect( Self, cnEvent )
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
::hEvents := {=>}
|
||||
|
||||
::__pSlots := NIL
|
||||
::__pEvents := NIL
|
||||
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, " _destroy()", "Exiting..." )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -443,7 +443,7 @@ PHB_ITEM hbqt_create_object( void * pObject, const char * pszObjectName )
|
||||
PHB_ITEM pRetVal;
|
||||
PHB_ITEM pItem;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "create_object %s", pszObjectName ) );
|
||||
HB_TRACE( HB_TR_ALWAYS, ( "create_object %s", pszObjectName ) );
|
||||
|
||||
hb_vmPushDynSym( hb_dynsymGet( pszObjectName ) );
|
||||
hb_vmPushNil();
|
||||
@@ -462,19 +462,22 @@ PHB_ITEM hbqt_create_objectGC( void * pObject, const char * pszObjectName )
|
||||
{
|
||||
PHB_ITEM pItem, pRetVal;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "create_object_GC %s", pszObjectName ) );
|
||||
//HB_TRACE( HB_TR_ALWAYS, ( "create_object_GC %s", pszObjectName ) );
|
||||
|
||||
hb_vmPushDynSym( hb_dynsymGet( pszObjectName ) );
|
||||
hb_vmPushNil();
|
||||
hb_vmDo( 0 );
|
||||
|
||||
pRetVal = hb_itemNew( hb_stackReturnItem() );
|
||||
|
||||
|
||||
pItem = hb_itemPutPtrGC( NULL, pObject );
|
||||
hb_objSendMsg( pRetVal, "_PPTR", 1, pItem );
|
||||
hb_itemReturnRelease( pRetVal );
|
||||
//hb_itemReturn( pRetVal );
|
||||
hb_itemRelease( pItem );
|
||||
|
||||
//HB_TRACE( HB_TR_ALWAYS, ( ".............................create_object_GC %s", pszObjectName ) );
|
||||
|
||||
return hb_stackReturnItem();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<CLASS>
|
||||
QObject = no
|
||||
Inherits = QObject
|
||||
Inherits =
|
||||
New = pParent
|
||||
</CLASS>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
<CLASS>
|
||||
QObject = no
|
||||
Inherit = QWidget
|
||||
Inherit =
|
||||
New = pParent
|
||||
</CLASS>
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
<CLASS>
|
||||
Inherit = QObject, QPaintDevice
|
||||
New = pParent, nFlags
|
||||
|
||||
PaintEvent = YES
|
||||
</CLASS>
|
||||
|
||||
<CODE>
|
||||
|
||||
Reference in New Issue
Block a user