From de3c57518e78b36cdb76e490a2ad7b833123037d Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 23 Mar 2011 01:18:51 +0000 Subject: [PATCH] 2011-03-22 18:12 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtcore/qth/QMimeData.qth * contrib/hbqt/qtgui/qth/QDropEvent.qth * contrib/hbqt/qtgui/qth/QGraphicsSceneDragDropEvent.qth ! Fixed: some manual code which was not taking use of new protocol. * contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp * contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp * contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp ! Changed: hbqt_create_object() => hbqt_create_objectGC() --- harbour/ChangeLog | 11 +++++++++++ harbour/contrib/hbqt/qtcore/qth/QMimeData.qth | 8 ++++---- .../contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp | 3 ++- .../contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp | 16 ++++++++++------ .../contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp | 6 +++++- harbour/contrib/hbqt/qtgui/qth/QDropEvent.qth | 7 ++++++- .../qtgui/qth/QGraphicsSceneDragDropEvent.qth | 6 +++++- 7 files changed, 43 insertions(+), 14 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7de3b95f57..33bbdd2dc7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,17 @@ The license applies to all entries newer than 2009-04-28. */ +2011-03-22 18:12 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtcore/qth/QMimeData.qth + * contrib/hbqt/qtgui/qth/QDropEvent.qth + * contrib/hbqt/qtgui/qth/QGraphicsSceneDragDropEvent.qth + ! Fixed: some manual code which was not taking use of new protocol. + + * contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp + * contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp + * contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp + ! Changed: hbqt_create_object() => hbqt_create_objectGC() + 2011-03-22 15:05 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtcore/hbqt_hbqevents.cpp * contrib/hbqt/qtcore/hbqt_hbqslots.cpp diff --git a/harbour/contrib/hbqt/qtcore/qth/QMimeData.qth b/harbour/contrib/hbqt/qtcore/qth/QMimeData.qth index 0325bff369..e35209be10 100644 --- a/harbour/contrib/hbqt/qtcore/qth/QMimeData.qth +++ b/harbour/contrib/hbqt/qtcore/qth/QMimeData.qth @@ -62,15 +62,15 @@ QList urls () const # Harbour Callable Function Till QList is not resolved # QStringList * hbUrlList() const{ - QMimeData * p = hbqt_par_QMimeData( 1 ); - if( p ) + QMimeData * _mimedata = ( QMimeData * ) hbqt_pPtrFromObj( 0 ); + if( _mimedata ) { QStringList strList; - foreach ( QUrl url, ( p )->urls() ) + foreach ( QUrl url, ( _mimedata )->urls() ) { strList << ( QString ) url.toString().toAscii().data(); } - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( strList ), true ) ); + hbqt_create_objectGC( hbqt_gcAllocate_QStringList( new QStringList( strList ), true ), "hb_QStringList" ); } } diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp index 8e5fa7a55a..644b4ef916 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp @@ -67,6 +67,7 @@ HB_EXTERN_BEGIN extern void * hbqt_gcAllocate_QPainter( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QGraphicsSceneContextMenuEvent( void * pObj, bool bNew ); HB_EXTERN_END HBQGraphicsItem::HBQGraphicsItem( int type, QGraphicsItem * parent ) : QGraphicsItem( parent ) @@ -487,7 +488,7 @@ void HBQGraphicsItem::contextMenuEvent( QGraphicsSceneContextMenuEvent * event ) { if( block ){ PHB_ITEM p1 = hb_itemPutNI( NULL, QEvent::GraphicsSceneContextMenu ); - PHB_ITEM p2 = hbqt_create_object( event, "hb_QGraphicsSceneContextMenuEvent" ); + PHB_ITEM p2 = hbqt_create_objectGC( hbqt_gcAllocate_QGraphicsSceneContextMenuEvent( event, false ), "hb_QGraphicsSceneContextMenuEvent" ); PHB_ITEM p3 = hb_itemPutC( NULL, objectName().toLatin1().data() ); hb_vmEvalBlockV( block, 3, p1, p2, p3 ); hb_itemRelease( p1 ); diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp index 50ef639383..fee638d7da 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp @@ -64,6 +64,10 @@ #include "hbqt_hbqgraphicsscene.h" +HB_EXTERN_BEGIN +extern void * hbqt_gcAllocate_QGraphicsSceneContextMenuEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QGraphicsSceneDragDropEvent( void * pObj, bool bNew ); +HB_EXTERN_END HBQGraphicsScene::HBQGraphicsScene( QObject * parent ) : QGraphicsScene( parent ) { @@ -407,7 +411,7 @@ void HBQGraphicsScene::contextMenuEvent( QGraphicsSceneContextMenuEvent * event if( ! item ){ if( block ){ PHB_ITEM p1 = hb_itemPutNI( NULL, QEvent::GraphicsSceneContextMenu ); - PHB_ITEM p2 = hbqt_create_object( event, "hb_QGraphicsSceneContextMenuEvent" ); + PHB_ITEM p2 = hbqt_create_objectGC( hbqt_gcAllocate_QGraphicsSceneContextMenuEvent( event, false ), "hb_QGraphicsSceneContextMenuEvent" ); hb_vmEvalBlockV( block, 2, p1, p2 ); hb_itemRelease( p1 ); hb_itemRelease( p2 ); @@ -421,7 +425,7 @@ void HBQGraphicsScene::dragEnterEvent( QGraphicsSceneDragDropEvent * event ) if( block ) { PHB_ITEM p1 = hb_itemPutNI( NULL, ( int ) QEvent::GraphicsSceneDragEnter ); - PHB_ITEM p2 = hbqt_create_object( event, "hb_QGraphicsSceneDragDropEvent" ); + PHB_ITEM p2 = hbqt_create_objectGC( hbqt_gcAllocate_QGraphicsSceneDragDropEvent( event, false ), "hb_QGraphicsSceneDragDropEvent" ); hb_vmEvalBlockV( block, 2, p1, p2 ); hb_itemRelease( p1 ); hb_itemRelease( p2 ); @@ -436,7 +440,7 @@ void HBQGraphicsScene::dragLeaveEvent( QGraphicsSceneDragDropEvent * event ) if( block ) { PHB_ITEM p1 = hb_itemPutNI( NULL, ( int ) QEvent::GraphicsSceneDragLeave ); - PHB_ITEM p2 = hbqt_create_object( event, "hb_QGraphicsSceneDragDropEvent" ); + PHB_ITEM p2 = hbqt_create_objectGC( hbqt_gcAllocate_QGraphicsSceneDragDropEvent( event, false ), "hb_QGraphicsSceneDragDropEvent" ); hb_vmEvalBlockV( block, 2, p1, p2 ); hb_itemRelease( p1 ); hb_itemRelease( p2 ); @@ -451,7 +455,7 @@ void HBQGraphicsScene::dragMoveEvent( QGraphicsSceneDragDropEvent * event ) if( block ) { PHB_ITEM p1 = hb_itemPutNI( NULL, ( int ) QEvent::GraphicsSceneDragMove ); - PHB_ITEM p2 = hbqt_create_object( event, "hb_QGraphicsSceneDragDropEvent" ); + PHB_ITEM p2 = hbqt_create_objectGC( hbqt_gcAllocate_QGraphicsSceneDragDropEvent( event, false ), "hb_QGraphicsSceneDragDropEvent" ); hb_vmEvalBlockV( block, 2, p1, p2 ); hb_itemRelease( p1 ); hb_itemRelease( p2 ); @@ -470,7 +474,7 @@ void HBQGraphicsScene::dropEvent( QGraphicsSceneDragDropEvent * event ) if( mime->hasFormat( ( QString ) "application/x-qabstractitemmodeldatalist" ) ) { PHB_ITEM p1 = hb_itemPutNI( NULL, ( int ) QEvent::GraphicsSceneDrop ); - PHB_ITEM p2 = hbqt_create_object( event, "hb_QGraphicsSceneDragDropEvent" ); + PHB_ITEM p2 = hbqt_create_objectGC( hbqt_gcAllocate_QGraphicsSceneDragDropEvent( event, false ), "hb_QGraphicsSceneDragDropEvent" ); PHB_ITEM p3 = hb_itemNew( NULL ); QTreeWidget * tree = dynamic_cast< QTreeWidget * >( event->source() ); @@ -498,7 +502,7 @@ void HBQGraphicsScene::dropEvent( QGraphicsSceneDragDropEvent * event ) else { PHB_ITEM p1 = hb_itemPutNI( NULL, ( int ) QEvent::GraphicsSceneDrop ); - PHB_ITEM p2 = hbqt_create_object( event, "hb_QGraphicsSceneDragDropEvent" ); + PHB_ITEM p2 = hbqt_create_objectGC( hbqt_gcAllocate_QGraphicsSceneDragDropEvent( event, false ), "hb_QGraphicsSceneDragDropEvent" ); hb_vmEvalBlockV( block, 2, p1, p2 ); hb_itemRelease( p1 ); hb_itemRelease( p2 ); diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp index 2bcfc9a629..1db5938552 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqplaintextedit.cpp @@ -74,6 +74,10 @@ #include "hbqt_hbqplaintextedit.h" +HB_EXTERN_BEGIN +extern void * hbqt_gcAllocate_QKeyEvent( void * pObj, bool bNew ); +HB_EXTERN_END + #include #define selectionState_off 0 @@ -1246,7 +1250,7 @@ bool HBQPlainTextEdit::hbKeyPressSelection( QKeyEvent * event ) hb_arraySetNI( p2, 4, columnEnds ); hb_arraySetNI( p2, 5, selectionMode ); hb_arraySetNI( p2, 6, selectionState ); - hb_arraySet( p2, 7, hbqt_create_object( event, "hb_QKeyEvent" ) ); + hb_arraySet( p2, 7, hbqt_create_objectGC( hbqt_gcAllocate_QKeyEvent( event, false ), "hb_QKeyEvent" ) ); hb_vmEvalBlockV( block, 2, p1, p2 ); hb_itemRelease( p1 ); hb_itemRelease( p2 ); diff --git a/harbour/contrib/hbqt/qtgui/qth/QDropEvent.qth b/harbour/contrib/hbqt/qtgui/qth/QDropEvent.qth index 7df2ec3403..c8e5b9f48a 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QDropEvent.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QDropEvent.qth @@ -21,6 +21,7 @@ Constructor = no #include +#include /* @@ -51,7 +52,11 @@ Qt::KeyboardModifiers keyboardModifiers () const # how to construct dynamically - no separate keyword ??? # const QMimeData * mimeData () const{ - hb_retptrGC( hbqt_gcAllocate_QMimeData( ( void* ) hbqt_par_QDropEvent( 1 )->mimeData(), false ) ); + QDropEvent * _dropevent = ( QDropEvent * ) hbqt_pPtrFromObj( 0 ); + if( _dropevent ) + { + hbqt_create_objectGC( hbqt_gcAllocate_QMimeData( ( void* ) _dropevent->mimeData(), true ), "hb_QMimeData" ); + } } # # diff --git a/harbour/contrib/hbqt/qtgui/qth/QGraphicsSceneDragDropEvent.qth b/harbour/contrib/hbqt/qtgui/qth/QGraphicsSceneDragDropEvent.qth index 270af1ed7d..50acb3a064 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QGraphicsSceneDragDropEvent.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QGraphicsSceneDragDropEvent.qth @@ -45,7 +45,11 @@ void acceptProposedAction () Qt::MouseButtons buttons () const Qt::DropAction dropAction () const const QMimeData * mimeData () const{ - hb_retptrGC( hbqt_gcAllocate_QMimeData( ( void* ) hbqt_par_QGraphicsSceneDragDropEvent( 1 )->mimeData(), false ) ); + QGraphicsSceneDragDropEvent * _graphicsscenedragdropevent = ( QGraphicsSceneDragDropEvent * ) hbqt_pPtrFromObj( 0 ); + if( _graphicsscenedragdropevent ) + { + hbqt_create_objectGC( hbqt_gcAllocate_QMimeData( ( void* ) _graphicsscenedragdropevent->mimeData(), true ), "hb_QMimeData" ); + } } Qt::KeyboardModifiers modifiers () const QPointF pos () const