2011-04-11 09:36 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)

* contrib/hbqt/qtcore/qth/HBQEvents.qth
    - Removed: tracelogs.

  * contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp
    ! Optimizations only.

  * contrib/hbxbp/xbpbrowse.prg
  * contrib/hbxbp/xbpdialog.prg
  * contrib/hbxbp/xbpgeneric.prg
  * contrib/hbxbp/xbpparthandler.prg
    + Implemented: Xbase++ compatible MDI engine.
      Now Xbase++ code can be compiled and run with this feature, Shum ?
      TODO: fix some small artifacts when XbpDialog() is made a MDI client.
            Resuming it back to desktop it is ok.
This commit is contained in:
Pritpal Bedi
2011-04-11 16:41:32 +00:00
parent 528fda3770
commit a6227a2e25
7 changed files with 81 additions and 44 deletions

View File

@@ -16,6 +16,22 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-04-11 09:36 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/qtcore/qth/HBQEvents.qth
- Removed: tracelogs.
* contrib/hbqt/qtgui/hbqt_hbqabstractitemmodel.cpp
! Optimizations only.
* contrib/hbxbp/xbpbrowse.prg
* contrib/hbxbp/xbpdialog.prg
* contrib/hbxbp/xbpgeneric.prg
* contrib/hbxbp/xbpparthandler.prg
+ Implemented: Xbase++ compatible MDI engine.
Now Xbase++ code can be compiled and run with this feature, Shum ?
TODO: fix some small artifacts when XbpDialog() is made a MDI client.
Resuming it back to desktop it is ok.
2011-04-10 12:43 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapicdp.h
* harbour/src/rtl/cdpapi.c

View File

@@ -52,11 +52,11 @@ static HB_GARBAGE_FUNC( hbqt_gcMark_HBQEvents )
for( i = t_slots->listBlock.size() - 1; i >= 0 ; i-- )
{
HB_TRACE( HB_TR_ALWAYS, ( "hbqt_gcMark_HBQEvents marking %d", i ) );
// HB_TRACE( HB_TR_ALWAYS, ( "hbqt_gcMark_HBQEvents marking %d", i ) );
if( t_slots->listBlock[ i ] != NULL )
{
hb_gcMark( t_slots->listBlock[ i ] );
HB_TRACE( HB_TR_ALWAYS, ( " MARKED %d ptr=%p", i, (void *)t_slots->listBlock.at( i ) ) );
// HB_TRACE( HB_TR_ALWAYS, ( " MARKED %d ptr=%p", i, (void *)t_slots->listBlock.at( i ) ) );
}
}
}

View File

@@ -97,19 +97,16 @@ QVariant hbqt_fetchData( PHB_ITEM block, int type, int role, int par1, int par2
{
vv = hb_itemGetL( ret );
HB_TRACE( HB_TR_DEBUG, ( " fetchData[ l = %i ]", hb_itemGetL( ret ) ) );
hb_itemRelease( ret );
}
else if( hb_itemType( ret ) & HB_IT_DOUBLE )
{
vv = hb_itemGetND( ret );
HB_TRACE( HB_TR_DEBUG, ( " fetchData[ d = %f ]", hb_itemGetND( ret ) ) );
hb_itemRelease( ret );
}
else if( hb_itemType( ret ) & HB_IT_NUMERIC )
{
vv = hb_itemGetNI( ret );
HB_TRACE( HB_TR_DEBUG, ( " fetchData[ n = %i ]", hb_itemGetNI( ret ) ) );
hb_itemRelease( ret );
}
else if( hb_itemType( ret ) & HB_IT_OBJECT )
{
@@ -132,8 +129,9 @@ QVariant hbqt_fetchData( PHB_ITEM block, int type, int role, int par1, int par2
else if( p->type == HBQT_TYPE_QFont )
vv = * ( ( QFont * ) ( p->ph ) );
hb_itemRelease( ret );
}
if( ret )
hb_itemRelease( ret );
hb_vmRequestRestore();
}
@@ -176,30 +174,22 @@ QVariant HBQAbstractItemModel::data( const QModelIndex & index, int role ) const
if( !index.isValid() )
return QVariant();
QVariant ret = hbqt_fetchData( block, HBQT_QAIM_data, role, index.column(), index.row() );
return ret;
return hbqt_fetchData( block, HBQT_QAIM_data, role, index.column(), index.row() );
}
QVariant HBQAbstractItemModel::headerData( int section, Qt::Orientation orientation, int role ) const
{
QVariant ret = hbqt_fetchData( block, HBQT_QAIM_headerData, role, orientation, section );
return ret;
return hbqt_fetchData( block, HBQT_QAIM_headerData, role, orientation, section );
}
int HBQAbstractItemModel::rowCount( const QModelIndex & /*parent = QModelIndex()*/ ) const
{
QVariant ret = hbqt_fetchData( block, HBQT_QAIM_rowCount, 0, 0, 0 );
return ret.toInt() ;
return hbqt_fetchData( block, HBQT_QAIM_rowCount, 0, 0, 0 ).toInt();
}
int HBQAbstractItemModel::columnCount( const QModelIndex & /*parent = QModelIndex()*/ ) const
{
QVariant ret = hbqt_fetchData( block, HBQT_QAIM_columnCount, 0, 0, 0 );
return ret.toInt() ;
return hbqt_fetchData( block, HBQT_QAIM_columnCount, 0, 0, 0 ).toInt();
}
QModelIndex HBQAbstractItemModel::index( int row, int column, const QModelIndex & parent ) const

View File

@@ -774,16 +774,14 @@ METHOD XbpBrowse:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oFooterView := QHeaderView( Qt_Horizontal )
//
::oFooterView:setHighlightSections( .F. )
::oFooterView:setMinimumHeight( 20 )
::oFooterView:setMaximumHeight( 20 )
::oFooterView:setResizeMode( QHeaderView_Fixed )
::oFooterView:setFocusPolicy( Qt_NoFocus )
//
::oFooterModel := HBQAbstractItemModel( {|t,role,x,y| ::supplyInfo( 142, t, role, x, y ) } )
//
::oFooterView:setModel( ::oFooterModel )
::oFooterView:setFocusPolicy( Qt_NoFocus )
/* Widget for ::setLeftFrozen( aColumns ) */
::buildLeftFreeze()
@@ -1240,7 +1238,7 @@ METHOD XbpBrowse:navigate( p1, p2 )
METHOD XbpBrowse:supplyInfo( nMode, nCall, nRole, nX, nY )
IF nCall == HBQT_QAIM_headerData .and. nX == Qt_Vertical
IF nCall == HBQT_QAIM_headerData .AND. nX == Qt_Vertical
RETURN NIL
ENDIF
@@ -1263,9 +1261,9 @@ METHOD XbpBrowse:supplyInfo( nMode, nCall, nRole, nX, nY )
ENDIF
RETURN ::rowCount
ELSEIF nCall == HBQT_QAIM_data
RETURN ::fetchColumnInfo( nCall,nRole, 0, nY+1, nX+1 )
RETURN ::fetchColumnInfo( nCall, nRole, 0, nY+1, nX+1 )
ELSEIF nCall == HBQT_QAIM_headerData
RETURN ::fetchColumnInfo( nCall,nRole, 0, 0 , nY+1 )
RETURN ::fetchColumnInfo( nCall, nRole, 0, 0, nY+1 )
ENDIF
RETURN nil
@@ -1276,9 +1274,9 @@ METHOD XbpBrowse:supplyInfo( nMode, nCall, nRole, nX, nY )
ENDIF
RETURN ::colCount
ELSEIF nCall == HBQT_QAIM_data
RETURN ::fetchColumnInfo( nCall,nRole, 1, nY+1, nX+1 )
RETURN ::fetchColumnInfo( nCall, nRole, 1, nY+1, nX+1 )
ELSEIF nCall == HBQT_QAIM_headerData
RETURN ::fetchColumnInfo( nCall,nRole, 1, 0 , nY+1 )
RETURN ::fetchColumnInfo( nCall, nRole, 1, 0, nY+1 )
ENDIF
RETURN nil
@@ -1343,7 +1341,7 @@ METHOD XbpBrowse:supplyInfo( nMode, nCall, nRole, nX, nY )
ENDCASE
RETURN nil
RETURN NIL
/*----------------------------------------------------------------------*/

View File

@@ -117,12 +117,17 @@ CLASS XbpDialog FROM XbpWindow
DATA aMinSize
METHOD minSize( aSize ) SETGET
DATA oMdi
DATA nFlags
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD XbpDialog:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
DEFAULT oParent TO AppDeskTop()
::xbpWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::resizeMode := 0
@@ -155,13 +160,6 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oWidget:setObjectName( "mainWindow" )
ENDIF
IF !empty( ::title )
::oWidget:setWindowTitle( ::title )
ENDIF
IF hb_isChar( ::icon )
::oWidget:setWindowIcon( ::icon )
ENDIF
IF !empty( ::qtObject )
::drawingArea:qtObject := ::oWidget:centralWidget()
::drawingArea:create()
@@ -172,12 +170,12 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
nFlags := ::oWidget:windowFlags()
nnFlags := nFlags
IF !( ::maxButton )
IF ! ::maxButton
IF hb_bitAnd( nFlags, Qt_WindowMaximizeButtonHint ) == Qt_WindowMaximizeButtonHint
nFlags -= Qt_WindowMaximizeButtonHint
ENDIF
ENDIF
IF !( ::minButton )
IF ! ::minButton
IF hb_bitAnd( nFlags, Qt_WindowMinimizeButtonHint ) == Qt_WindowMinimizeButtonHint
nFlags -= Qt_WindowMinimizeButtonHint
ENDIF
@@ -195,8 +193,21 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
::oWidget:setWindowFlags( nFlags )
ENDIF
IF !empty( ::title )
::oWidget:setWindowTitle( ::title )
ENDIF
IF hb_isChar( ::icon )
::oWidget:setWindowIcon( ::icon )
ENDIF
::nFlags := nFlags
IF __objGetClsName( ::oParent ) == "XBPDRAWINGAREA"
::setParent( ::oParent )
ELSE
::setPosAndSize()
ENDIF
//::setQtProperty()
::setPosAndSize()
IF ::visible
::show()
ENDIF
@@ -225,6 +236,11 @@ METHOD XbpDialog:destroy()
HB_TRACE( HB_TR_DEBUG, ". " )
HB_TRACE( HB_TR_DEBUG, "<<<<<<<<<< XbpDialog:destroy B >>>>>>>>>>" )
IF ! empty( ::oMdi )
// ::oParent:oWidget:removeSubWindow( ::oMdi )
::oMdi := NIL
ENDIF
::disconnectWindowEvents()
::oWidget:disconnect( QEvent_Close )
::oWidget:disconnect( QEvent_WindowActivate )
@@ -375,6 +391,8 @@ CLASS XbpDrawingArea INHERIT XbpWindow
METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible )
DATA oBrush
ENDCLASS
/*----------------------------------------------------------------------*/
@@ -397,11 +415,16 @@ METHOD XbpDrawingArea:create( oParent, oOwner, aPos, aSize, aPresParams, lVisibl
IF ! empty( ::qtObject )
::oWidget := ::qtObject:oWidget
ELSE
#if 0
::oWidget := QWidget()
#else
::oWidget := QMdiArea()
::oBrush := QApplication():palette():button()
::oWidget:setBackground( ::oBrush )
#endif
ENDIF
::oWidget:setMouseTracking( .T. )
// ::oWidget:setFocusPolicy( Qt_StrongFocus )
::oWidget:setFocusPolicy( Qt_NoFocus )
::oWidget:setObjectName( hbxbp_getNextID( "XBaseDrawingArea" ) )

View File

@@ -293,8 +293,7 @@ FUNCTION SetAppFocus( oXbp )
FUNCTION AppDesktop()
IF s_oDeskTop == NIL
s_oDeskTop := XbpWindow():new()
s_oDeskTop:oWidget := HbpAppDesktop():new():create()
s_oDeskTop := HbpAppDesktop():new():create()
ENDIF
RETURN s_oDeskTop

View File

@@ -92,7 +92,7 @@ CLASS XbpPartHandler
METHOD delChild( oXbp )
METHOD setName( nNameId )
METHOD setOwner( oXbp )
METHOD setParent( oXbp )
METHOD setParent( oParent )
METHOD notifier()
@@ -251,11 +251,22 @@ METHOD setOwner( oXbp ) CLASS XbpPartHandler
/*----------------------------------------------------------------------*/
METHOD setParent( oXbp ) CLASS XbpPartHandler
METHOD setParent( oParent ) CLASS XbpPartHandler
LOCAL oOldXbp := ::oParent
IF valtype( oXbp ) == "O"
::oParent := oXbp
IF valtype( oParent ) == "O"
IF __objHasMsg( Self, "OMDI" )
IF ! empty( ::oMdi )
::oParent:oWidget:removeSubWindow( ::oWidget ) //::oMdi )
::oWidget:setWindowFlags( ::nFlags )
::oMdi:close()
::oMdi := NIL
ELSEIF __objGetClsName( oParent ) == "XBPDRAWINGAREA"
::oMdi := oParent:oWidget:addSubWindow( ::oWidget )
ENDIF
::oWidget:show()
ENDIF
::oParent := oParent
ENDIF
RETURN oOldXbp