Thank you!
Title is error, it's 'QTextCodec' not 'QTextDecodec', sorry!!
and modify again:
hbqt_qtextcodec.cpp
/*--------------------*/
HB_FUNC( QT_QTEXTCODEC_CODECFORNAME )
{
hb_retptr( (QTextCodec *) hbqt_par_QTextCodec( 1 )->codecForName( (const
char *)hb_parcx(2)) );
}
HB_FUNC( QT_QTEXTCODEC_CODECFORTR )
{
hb_retptr( (QTextCodec *) hbqt_par_QTextCodec( 1 )->codecForTr() );
}
HB_FUNC( QT_QTEXTCODEC_CODECFORLOCALE )
{
hb_retptr( (QTextCodec *) hbqt_par_QTextCodec( 1 )->codecForLocale() );
}
HB_FUNC( QT_QTEXTCODEC_SETCODECFORCSTRINGS )
{
hbqt_par_QTextCodec( 1 )->setCodecForCStrings( (QTextCodec *) hb_parptr(2) );
}
HB_FUNC( QT_QTEXTCODEC_SETCODECFORTR )
{
hbqt_par_QTextCodec( 1 )->setCodecForTr( (QTextCodec *) hb_parptr(2) );
}
HB_FUNC( QT_QTEXTCODEC_SETCODECFORLOCALE )
{
hbqt_par_QTextCodec( 1 )->setCodecForLocale( (QTextCodec *) hb_parptr(2) );
}
/*--------------------*/
TQTextCodec.prg
/*--------------------*/
METHOD codecForLocale() INLINE
Qt_QTextCodec_codecForLocale( ::pPtr )
METHOD codecForName( cStr ) INLINE
Qt_QTextCodec_codecForName( ::pPtr, cStr )
METHOD codecForTr() INLINE
Qt_QTextCodec_codecForTr( ::pPtr )
//
METHOD setCodecForLocale( pPtr ) INLINE
Qt_QTextCodec_setCodecForLocale( ::pPtr, pPtr )
METHOD setCodecForCStrings( pPtr ) INLINE
Qt_QTextCodec_setCodecForCStrings( ::pPtr, pPtr )
METHOD setCodecForTr( pPtr ) INLINE
Qt_QTextCodec_setCodecForTr( ::pPtr, pPtr )
/*--------------------*/
and have other problem,
I had try use:
oQTC := QTextCodec():New()
pPtr := oQTC:codecForName( "Big5-ETen" )
oQTC:setCodecForCStrings( pPtr )
oQTC:toUnicode_1( "Chinese test!! 中文測試" ) // --> occur GPF
and about QObject add function:
hbqt_qobject.cpp
/*--------------------*/
HB_FUNC( QT_QOBJECT_TR )
{
hb_retc( hbqt_par_QObject( 1 )->tr( (char *) hb_parcx(2) ).toLatin1().data()
);
}
/*--------------------*/
TQObject.prg
/*--------------------*/
METHOD tr( cStr ) INLINE Qt_QObject_tr( ::pPtr,
cStr )
/*--------------------*/
demo.prg
oQTC := QTextCodec():New()
pPtr := oQTC:codecForName( 'Big5-ETen' )
oQTC:setCodecForCStrings( pPtr )
oQO := QObject():New()
oQL := QLabel():New()
oQL:setText( oQO:tr( '<center><h1>Qt4 Chinese test 中文 測試
!!</h1></center>' ))
oQL:setWindowTitle( '3' )
oQL:resize( 200, 50 )
oQL:show()
other problem, I had try:
// under is ok ----------------
oQTC := QTextCodec():New()
pPtr := oQTC:codecForName( "Big5-ETen" )
oQTC:setCodecForCStrings( pPtr )
// under is fail -------------
oQTC := QTextCodec():New()
pPtr := oQTC:codecForName( "Big5-ETen" )
oQTC:setCodecForTr( pPtr )
oQO:tr( '......' ) is show ugly code.
> >
> > Please add some function into:
> > hbqt_qtextcodec.cpp
> > /* --------------------- */
> > HB_FUNC( QT_QTEXTCODEC_CODECFORNAME )
> > {
> > hb_retptr( (QTextCodec *) hbqt_par_QTextCodec( 1 )->codecForName(
> > (const char *)hb_parcx(2) ));
> > }
> > HB_FUNC( QT_QTEXTCODEC_SETCODECFORCSTRINGS )
> > {
> > hbqt_par_QTextCodec( 1 )->setCodecForCStrings( (QTextCodec *)
> > hb_parptr(2) );
> > hb_ret();
> > }
> >
>
> For sure it should be if not in the lib already.
> I will see why these skipped.
>
> Regards
> Pritpal Bedi
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour