From b5269fd82bbcf6b8d24a278e6e71222f58b09b67 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 18 Aug 2010 07:23:45 +0000 Subject: [PATCH] 2010-08-18 12:19 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/g/QGraphicsScene.cpp * contrib/hbqt/qtgui/qth/QGraphicsScene.qth % Fixed: GPF on exit. QGraphicsScene:addItem() is owned by the scene. --- harbour/ChangeLog | 5 +++++ harbour/contrib/hbqt/qtgui/g/QGraphicsScene.cpp | 15 +++++++++------ harbour/contrib/hbqt/qtgui/qth/QGraphicsScene.qth | 12 +++++++++++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 569b883716..0669d267cb 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,11 @@ The license applies to all entries newer than 2009-04-28. */ +2010-08-18 12:19 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtgui/g/QGraphicsScene.cpp + * contrib/hbqt/qtgui/qth/QGraphicsScene.qth + % Fixed: GPF on exit. QGraphicsScene:addItem() is owned by the scene. + 2010-08-17 20:32 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + contrib/hbqt/qtgui/hbqt_hbqgraphicsrectitem.cpp + Added: miss from the prev commit. diff --git a/harbour/contrib/hbqt/qtgui/g/QGraphicsScene.cpp b/harbour/contrib/hbqt/qtgui/g/QGraphicsScene.cpp index ad37a93ad0..d45c3d3f59 100644 --- a/harbour/contrib/hbqt/qtgui/g/QGraphicsScene.cpp +++ b/harbour/contrib/hbqt/qtgui/g/QGraphicsScene.cpp @@ -73,11 +73,12 @@ */ /* - * Constructed[ 69/71 [ 97.18% ] ] + * Constructed[ 69/72 [ 95.83% ] ] * * *** Unconvered Prototypes *** * ----------------------------- * + * } * QGraphicsItemGroup * createItemGroup ( const QList & items ) * * *** Commented out protos which construct fine but do not compile *** @@ -241,12 +242,14 @@ HB_FUNC( QT_QGRAPHICSSCENE_ADDELLIPSE_1 ) */ HB_FUNC( QT_QGRAPHICSSCENE_ADDITEM ) { - QGraphicsScene * p = hbqt_par_QGraphicsScene( 1 ); - if( p ) - ( p )->addItem( hbqt_par_QGraphicsItem( 2 ) ); - else + HBQT_GC_T * p = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 1 ); + HBQT_GC_T * q = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 2 ); + HB_TRACE( HB_TR_DEBUG, ( "Entering function QT_QGRAPHICSSCENE_ADDITEM()" ) ); + if( p && p->ph && q && q->ph ) { - HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QGRAPHICSSCENE_ADDITEM FP=( p )->addItem( hbqt_par_QGraphicsItem( 2 ) ); p is NULL" ) ); + HB_TRACE( HB_TR_DEBUG, ( "QT_QGRAPHICSSCENE_ADDITEM() Qt object: %p is attached to: %p", p->ph, q->ph ) ); + q->bNew = HB_FALSE; + hbqt_par_QGraphicsScene( 1 )->addItem( hbqt_par_QGraphicsItem( 2 ) ); } } diff --git a/harbour/contrib/hbqt/qtgui/qth/QGraphicsScene.qth b/harbour/contrib/hbqt/qtgui/qth/QGraphicsScene.qth index 6c68ea7b41..49863b10cb 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QGraphicsScene.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QGraphicsScene.qth @@ -110,7 +110,17 @@ flags SceneLayers QGraphicsWidget * activeWindow () const QGraphicsEllipseItem * addEllipse ( const QRectF & rect, const QPen & pen = QPen(), const QBrush & brush = QBrush() ) QGraphicsEllipseItem * addEllipse ( qreal x, qreal y, qreal w, qreal h, const QPen & pen = QPen(), const QBrush & brush = QBrush() ) -void addItem ( QGraphicsItem * item ) +void addItem ( QGraphicsItem * item ){ + HBQT_GC_T * p = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 1 ); + HBQT_GC_T * q = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 2 ); + HB_TRACE( HB_TR_DEBUG, ( "Entering function QT_QGRAPHICSSCENE_ADDITEM()" ) ); + if( p && p->ph && q && q->ph ) + { + HB_TRACE( HB_TR_DEBUG, ( "QT_QGRAPHICSSCENE_ADDITEM() Qt object: %p is attached to: %p", p->ph, q->ph ) ); + q->bNew = HB_FALSE; + hbqt_par_QGraphicsScene( 1 )->addItem( hbqt_par_QGraphicsItem( 2 ) ); + } +} QGraphicsLineItem * addLine ( const QLineF & line, const QPen & pen = QPen() ) QGraphicsLineItem * addLine ( qreal x1, qreal y1, qreal x2, qreal y2, const QPen & pen = QPen() ) QGraphicsPathItem * addPath ( const QPainterPath & path, const QPen & pen = QPen(), const QBrush & brush = QBrush() )