2011-09-06 11:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbqt/qtcore/hbqt_hbqevents.cpp
    + patch for implementation of events handling according to Qt docs.
      It MAY break existing code, please read:
      up to now the event handler always returned false. That means the
      event was propagated to parent widget. Sometimes it is necessary to
      stop event propagation and so we must return the boolean value
      returned from the codeblock.
      So, if your codeblock returned .F. or a non-boolean value the code is
      ok, if it returned .T. it may broke functionality.
      Patch from Francesco Perillo (with minor type fix)
    * minor formatting/indenting, removed old 'DO NOT Reformat' comment
This commit is contained in:
Viktor Szakats
2011-09-06 09:05:13 +00:00
parent 638960aec7
commit 27fa4aab79
2 changed files with 25 additions and 8 deletions

View File

@@ -16,7 +16,20 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-09-05 10:32 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
2011-09-06 11:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/qtcore/hbqt_hbqevents.cpp
+ patch for implementation of events handling according to Qt docs.
It MAY break existing code, please read:
up to now the event handler always returned false. That means the
event was propagated to parent widget. Sometimes it is necessary to
stop event propagation and so we must return the boolean value
returned from the codeblock.
So, if your codeblock returned .F. or a non-boolean value the code is
ok, if it returned .T. it may broke functionality.
Patch from Francesco Perillo (with minor type fix)
* minor formatting/indenting, removed old 'DO NOT Reformat' comment
2011-09-06 10:32 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbgs/hbgs.hbp
* contrib/hbodbc/hbodbc.hbp
* contrib/sddodbc/sddodbc.hbp

View File

@@ -211,10 +211,10 @@ int HBQEvents::hbDisconnect( PHB_ITEM pObj, int type )
return nResult;
}
/* DO NOT Reformat */
bool HBQEvents::eventFilter( QObject * object, QEvent * event )
{
bool stopTheEventChain = false;
if( object )
{
QEvent::Type eventtype = event->type();
@@ -237,7 +237,11 @@ bool HBQEvents::eventFilter( QObject * object, QEvent * event )
if( hb_vmRequestReenter() )
{
PHB_ITEM pItem = hb_itemNew( hbqt_create_objectGC( ( * pCallback )( event, false ), s_lstCreateObj.at( eventId ) ) );
hb_vmEvalBlockV( ( PHB_ITEM ) listBlock.at( found - 1 ), 1, pItem );
PHB_ITEM ret = hb_vmEvalBlockV( ( PHB_ITEM ) listBlock.at( found - 1 ), 1, pItem );
if( hb_itemType( ret ) & HB_IT_LOGICAL )
stopTheEventChain = ( bool ) hb_itemGetL( ret );
hb_itemRelease( pItem );
hb_vmRequestRestore();
}
@@ -245,13 +249,13 @@ bool HBQEvents::eventFilter( QObject * object, QEvent * event )
}
}
}
if( eventtype == QEvent::Close )
{
return true;
}
return true;
}
}
return false;
return stopTheEventChain;
}
static void hbqt_events_init( void * cargo )