From b3934d258a9c3380838fd684a035fa2d54aa3cf7 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Fri, 17 Sep 2010 22:32:50 +0000 Subject: [PATCH] 2010-09-17 15:31 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/g/QComboBox.cpp * Re-generated. * contrib/hbqt/qtgui/qth/QComboBox.qth ! Detached one child from GC cycle - :setView() * contrib/hbxbp/xbpcombobox.prg ! Fixed to support inheritance. Thanks Shum for real-time Xbase++ code example. Now it can be compiled with Harbour + hbQT without any line change. --- harbour/ChangeLog | 13 ++++++++ harbour/contrib/hbqt/qtgui/g/QComboBox.cpp | 17 +++++++++-- harbour/contrib/hbqt/qtgui/qth/QComboBox.qth | 10 ++++++- harbour/contrib/hbxbp/xbpcombobox.prg | 31 +++++++++++++------- 4 files changed, 56 insertions(+), 15 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6dcbf4b6e3..bea8282a7d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,19 @@ The license applies to all entries newer than 2009-04-28. */ +2010-09-17 15:31 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtgui/g/QComboBox.cpp + * Re-generated. + + * contrib/hbqt/qtgui/qth/QComboBox.qth + ! Detached one child from GC cycle - :setView() + + * contrib/hbxbp/xbpcombobox.prg + ! Fixed to support inheritance. + + Thanks Shum for real-time Xbase++ code example. + Now it can be compiled with Harbour + hbQT without any line change. + 2010-09-17 08:19 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/qth/QIcon.qth ! An important change in constructor. diff --git a/harbour/contrib/hbqt/qtgui/g/QComboBox.cpp b/harbour/contrib/hbqt/qtgui/g/QComboBox.cpp index 27c61930fb..4960b5ed2f 100644 --- a/harbour/contrib/hbqt/qtgui/g/QComboBox.cpp +++ b/harbour/contrib/hbqt/qtgui/g/QComboBox.cpp @@ -71,6 +71,15 @@ * enum SizeAdjustPolicy { AdjustToContents, AdjustToContentsOnFirstShow, AdjustToMinimumContentsLength, AdjustToMinimumContentsLengthWithIcon } */ +/* + * Constructed[ 59/60 [ 98.33% ] ] + * + * *** Unconvered Prototypes *** + * ----------------------------- + * + * } + */ + #include #include @@ -772,10 +781,12 @@ HB_FUNC( QT_QCOMBOBOX_SETVALIDATOR ) */ HB_FUNC( QT_QCOMBOBOX_SETVIEW ) { - QComboBox * p = hbqt_par_QComboBox( 1 ); - if( p ) + HBQT_GC_T * p = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 1 ); + HBQT_GC_T * q = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 2 ); + if( p && p->ph && q && q->ph ) { - ( p )->setView( hbqt_par_QAbstractItemView( 2 ) ); + q->bNew = HB_FALSE; + hbqt_par_QComboBox( 1 )->setView( hbqt_par_QAbstractItemView( 2 ) ); } } diff --git a/harbour/contrib/hbqt/qtgui/qth/QComboBox.qth b/harbour/contrib/hbqt/qtgui/qth/QComboBox.qth index 420536a1e1..fc2991a591 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QComboBox.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QComboBox.qth @@ -133,7 +133,15 @@ void setModelColumn ( int visibleColumn ) void setRootModelIndex ( const QModelIndex & index ) void setSizeAdjustPolicy ( SizeAdjustPolicy policy ) void setValidator ( const QValidator * validator ) -void setView ( QAbstractItemView * itemView ) +void setView ( QAbstractItemView * itemView ){ + HBQT_GC_T * p = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 1 ); + HBQT_GC_T * q = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 2 ); + if( p && p->ph && q && q->ph ) + { + q->bNew = HB_FALSE; + hbqt_par_QComboBox( 1 )->setView( hbqt_par_QAbstractItemView( 2 ) ); + } +} virtual void showPopup () SizeAdjustPolicy sizeAdjustPolicy () const virtual const QValidator * validator () const diff --git a/harbour/contrib/hbxbp/xbpcombobox.prg b/harbour/contrib/hbxbp/xbpcombobox.prg index 658070f43a..56f9ff8eb1 100644 --- a/harbour/contrib/hbxbp/xbpcombobox.prg +++ b/harbour/contrib/hbxbp/xbpcombobox.prg @@ -78,6 +78,7 @@ CLASS XbpComboBox INHERIT XbpWindow DATA type INIT XBPCOMBO_DROPDOWN DATA drawMode INIT XBP_DRAW_NORMAL +// MESSAGE init( ... ) METHOD new( ... ) METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) METHOD hbCreateFromQtPtr( oParent, oOwner, aPos, aSize, aPresParams, lVisible, pQtObject ) @@ -134,14 +135,17 @@ METHOD XbpComboBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::xbpWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - ::oSLE := XbpSLE():new():create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - ::oLB := XbpListBox():new():create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + ::oSLE := XbpSLE():new():create( ::oParent, ::oOwner, ::aPos, ::aSize, ::aPresParams, ::visible ) + ::oLB := XbpListBox():new():create( ::oParent, ::oOwner, ::aPos, ::aSize, ::aPresParams, ::visible ) ::oWidget := QComboBox( ::pParent ) - ::oWidget:setLineEdit( ::XbpSLE:oWidget:pPtr ) - ::oWidget:setEditable( ::XbpSLE:editable ) - ::oWidget:setFrame( ::XbpSLE:border ) + ::oWidget:setModel( QAbstractItemModel():from( ::xbpListBox:model() ) ) + ::oWidget:setView( ::xbpListBox:oWidget ) + ::oWidget:setLineEdit( ::xbpSLE:oWidget ) + //::oWidget:setLineEdit( ::XbpSLE:oWidget:pPtr ) + ::oWidget:setEditable( ::xbpSLE:editable ) + ::oWidget:setFrame( ::xbpSLE:border ) ::oWidget:connect( "highlighted(int)" , {|i| ::execSlot( "highlighted(int)" , i ) } ) ::oWidget:connect( "activated(int)" , {|i| ::execSlot( "activated(int)" , i ) } ) @@ -166,18 +170,20 @@ METHOD XbpComboBox:hbCreateFromQtPtr( oParent, oOwner, aPos, aSize, aPresParams, ::oWidget:pPtr := pQtObject ELSE - ::oSLE := XbpSLE():new():create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - ::oLB := XbpListBox():new():create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + ::oSLE := XbpSLE():new():create( ::oParent, ::oOwner, ::aPos, ::aSize, ::aPresParams, ::lVisible ) + ::oLB := XbpListBox():new():create( ::oParent, ::oOwner, ::aPos, ::aSize, ::aPresParams, ::lVisible ) ::oWidget := QComboBox( ::pParent ) + ::oWidget:setModel( QAbstractItemModel():from( ::xbpListBox:model() ) ) + ::oWidget:setView( ::xbpListBox:oWidget ) + ::oWidget:setLineEdit( ::xbpSLE:oWidget ) + ::oWidget:setEditable( ::xbpSLE:editable ) + ::oWidget:setFrame( ::xbpSLE:border ) + ::setPosAndSize() IF ::visible ::show() ENDIF - ::oWidget:setLineEdit( ::XbpSLE:oWidget ) - ::oWidget:setEditable( ::XbpSLE:editable ) - ::oWidget:setFrame( ::XbpSLE:border ) - ENDIF ::oWidget:connect( "highlighted(int)" , {|i| ::execSlot( "highlighted(int)" , i ) } ) @@ -191,6 +197,9 @@ METHOD XbpComboBox:hbCreateFromQtPtr( oParent, oOwner, aPos, aSize, aPresParams, METHOD XbpComboBox:destroy() + ::xbpSLE:destroy() + ::xbpListBox:destroy() + ::xbpWindow:destroy() RETURN NIL