2010-10-28 19:25 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/qtcore/hbqt_misc.prg
* Laxed the rules for handling low-level connect/disconnect errors.
Now some cases will now RTE, some will return .F., some will get
ignored and .T. returned. Please refine it as required.
* Optimized :connect()/:disconnect()
* contrib/hbqt/qtcore/hbqt_hbqslots.cpp
! __HBQT_SLOTS_CONNECT() fixed to check for codeblock parameter
before actually making the connection on QT level.
Hopefully this was not some intentional feature.
* contrib/hbxbp/xbpmenubar.prg
! xbpMenuBar:delItem() fixed :disconnect() calls with wrong parameter.
Blindish fix, pls review and test.
This commit is contained in:
@@ -16,6 +16,22 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2010-10-28 19:25 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbqt/qtcore/hbqt_misc.prg
|
||||
* Laxed the rules for handling low-level connect/disconnect errors.
|
||||
Now some cases will now RTE, some will return .F., some will get
|
||||
ignored and .T. returned. Please refine it as required.
|
||||
* Optimized :connect()/:disconnect()
|
||||
|
||||
* contrib/hbqt/qtcore/hbqt_hbqslots.cpp
|
||||
! __HBQT_SLOTS_CONNECT() fixed to check for codeblock parameter
|
||||
before actually making the connection on QT level.
|
||||
Hopefully this was not some intentional feature.
|
||||
|
||||
* contrib/hbxbp/xbpmenubar.prg
|
||||
! xbpMenuBar:delItem() fixed :disconnect() calls with wrong parameter.
|
||||
Blindish fix, pls review and test.
|
||||
|
||||
2010-10-28 16:19 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbqt/tests/demoqt.prg
|
||||
! Fixed wrong :connect call. Thanks to Tamas Tevesz for pinpointing it.
|
||||
|
||||
@@ -204,24 +204,24 @@ HB_FUNC( __HBQT_SLOTS_CONNECT )
|
||||
QObject * object = ( QObject * ) hbqt_pPtrFromObj( 2 ); /* get sender */
|
||||
if( object )
|
||||
{
|
||||
int i = object->property( hb_parcx( 3 ) ).toInt();
|
||||
if( i == 0 )
|
||||
PHB_ITEM pBlock = hb_itemNew( hb_param( 4, HB_IT_BLOCK ) ); /* get codeblock */
|
||||
if( pBlock )
|
||||
{
|
||||
QString signal = hb_parcx( 3 );
|
||||
QByteArray theSignal = QMetaObject::normalizedSignature( signal.toAscii() );
|
||||
|
||||
if( QMetaObject::checkConnectArgs( theSignal, theSignal ) )
|
||||
int i = object->property( hb_parcx( 3 ) ).toInt();
|
||||
if( i == 0 )
|
||||
{
|
||||
int signalId = object->metaObject()->indexOfSignal( theSignal );
|
||||
if( signalId != -1 )
|
||||
QString signal = hb_parcx( 3 );
|
||||
QByteArray theSignal = QMetaObject::normalizedSignature( signal.toAscii() );
|
||||
|
||||
if( QMetaObject::checkConnectArgs( theSignal, theSignal ) )
|
||||
{
|
||||
int slotId = object->metaObject()->indexOfMethod( theSignal );
|
||||
if( slotId != -1 )
|
||||
int signalId = object->metaObject()->indexOfSignal( theSignal );
|
||||
if( signalId != -1 )
|
||||
{
|
||||
if( QMetaObject::connect( object, signalId, t_slots, slotId + QObject::staticMetaObject.methodCount(), Qt::AutoConnection ) )
|
||||
int slotId = object->metaObject()->indexOfMethod( theSignal );
|
||||
if( slotId != -1 )
|
||||
{
|
||||
PHB_ITEM pBlock = hb_itemNew( hb_param( 4, HB_IT_BLOCK ) ); /* get codeblock */
|
||||
if( pBlock )
|
||||
if( QMetaObject::connect( object, signalId, t_slots, slotId + QObject::staticMetaObject.methodCount(), Qt::AutoConnection ) )
|
||||
{
|
||||
t_slots->listBlock << pBlock;
|
||||
|
||||
|
||||
@@ -131,10 +131,6 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock )
|
||||
::__pSlots := __hbqt_slots_new()
|
||||
ENDIF
|
||||
nResult := __hbqt_slots_connect( ::__pSlots, ::pPtr, cnEvent, bBlock )
|
||||
IF nResult == 0
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
__hbqt_error( 1300 + nResult )
|
||||
EXIT
|
||||
|
||||
CASE "N"
|
||||
@@ -144,18 +140,21 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock )
|
||||
::installEventFilter( HBQEventsFromPointer( ::__pEvents ) )
|
||||
ENDIF
|
||||
nResult := __hbqt_events_connect( ::__pEvents, ::pPtr, cnEvent, bBlock )
|
||||
IF nResult == 0
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
__hbqt_error( 1200 + nResult )
|
||||
EXIT
|
||||
|
||||
OTHERWISE
|
||||
|
||||
__hbqt_error( 1203 )
|
||||
|
||||
nResult := 99
|
||||
ENDSWITCH
|
||||
|
||||
SWITCH nResult
|
||||
CASE 0
|
||||
RETURN .T.
|
||||
CASE 8 /* QT connect call failure */
|
||||
RETURN .F.
|
||||
ENDSWITCH
|
||||
|
||||
__hbqt_error( 1200 + nResult )
|
||||
|
||||
RETURN .F.
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -165,37 +164,27 @@ METHOD HbQtObjectHandler:disconnect( cnEvent )
|
||||
|
||||
SWITCH ValType( cnEvent )
|
||||
CASE "C"
|
||||
|
||||
IF Empty( ::__pSlots )
|
||||
__hbqt_error( 1301 )
|
||||
ELSE
|
||||
nResult := __hbqt_slots_disconnect( ::__pSlots, ::pPtr, cnEvent )
|
||||
IF nResult == 0
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
__hbqt_error( 1350 + nResult )
|
||||
ENDIF
|
||||
nResult := __hbqt_slots_disconnect( ::__pSlots, ::pPtr, cnEvent )
|
||||
EXIT
|
||||
|
||||
CASE "N"
|
||||
|
||||
IF Empty( ::__pEvents )
|
||||
__hbqt_error( 1201 )
|
||||
ELSE
|
||||
nResult := __hbqt_events_disconnect( ::__pEvents, ::pPtr, cnEvent )
|
||||
IF nResult == 0
|
||||
RETURN .T.
|
||||
ENDIF
|
||||
__hbqt_error( 1250 + nResult )
|
||||
ENDIF
|
||||
nResult := __hbqt_events_disconnect( ::__pEvents, ::pPtr, cnEvent )
|
||||
EXIT
|
||||
|
||||
OTHERWISE
|
||||
|
||||
__hbqt_error( 1202 )
|
||||
|
||||
nResult := 99
|
||||
ENDSWITCH
|
||||
|
||||
SWITCH nResult
|
||||
CASE 0
|
||||
CASE 4 /* signal not found in object */
|
||||
CASE 5 /* disconnect failure */
|
||||
RETURN .T.
|
||||
CASE 1 /* wrong slot container, no connect was called yet */
|
||||
CASE 3 /* event not found */
|
||||
RETURN .F.
|
||||
ENDSWITCH
|
||||
|
||||
__hbqt_error( 1300 + nResult )
|
||||
|
||||
RETURN .F.
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -232,8 +232,8 @@ METHOD xbpMenuBar:delItem( aItem )
|
||||
|
||||
IF hb_isObject( aItem[ 5 ] ) .AND. __ObjGetClsName( aItem[ 5 ] ) == "QACTION"
|
||||
IF !( aItem[ 5 ]:isSeparator() )
|
||||
::disConnect( aItem[ 5 ], "triggered(bool)" )
|
||||
::disConnect( aItem[ 5 ], "hovered()" )
|
||||
aItem[ 5 ]:disConnect( "triggered(bool)" )
|
||||
aItem[ 5 ]:disConnect( "hovered()" )
|
||||
ENDIF
|
||||
::oWidget:removeAction( aItem[ 5 ] )
|
||||
aItem[ 5 ] := NIL
|
||||
|
||||
Reference in New Issue
Block a user