diff options
Diffstat (limited to 'doc/html/i18n-example.html')
-rw-r--r-- | doc/html/i18n-example.html | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/doc/html/i18n-example.html b/doc/html/i18n-example.html index b4f469e8f..1cd12b0d7 100644 --- a/doc/html/i18n-example.html +++ b/doc/html/i18n-example.html @@ -52,15 +52,15 @@ This example shows how to internationalize applications. Start it with #ifndef MYWIDGET_H #define MYWIDGET_H -#include <<a href="qmainwindow-h.html">qmainwindow.h</a>> -#include <<a href="qstring-h.html">qstring.h</a>> +#include <<a href="qmainwindow-h.html">ntqmainwindow.h</a>> +#include <<a href="qstring-h.html">ntqstring.h</a>> -class MyWidget : public <a href="qmainwindow.html">TQMainWindow</a> +class MyWidget : public <a href="ntqmainwindow.html">TQMainWindow</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: - MyWidget( <a href="qwidget.html">TQWidget</a>* parent=0, const char* name = 0 ); + MyWidget( <a href="ntqwidget.html">TQWidget</a>* parent=0, const char* name = 0 ); signals: void closed(); @@ -87,47 +87,47 @@ private: ** *****************************************************************************/ -#include <<a href="qbuttongroup-h.html">qbuttongroup.h</a>> -#include <<a href="qradiobutton-h.html">qradiobutton.h</a>> -#include <<a href="qlabel-h.html">qlabel.h</a>> -#include <<a href="qlistbox-h.html">qlistbox.h</a>> -#include <<a href="qcombobox-h.html">qcombobox.h</a>> -#include <<a href="qlabel-h.html">qlabel.h</a>> -#include <<a href="qhbox-h.html">qhbox.h</a>> -#include <<a href="qvbox-h.html">qvbox.h</a>> -#include <<a href="qaccel-h.html">qaccel.h</a>> -#include <<a href="qpopupmenu-h.html">qpopupmenu.h</a>> -#include <<a href="qmenubar-h.html">qmenubar.h</a>> -#include <<a href="qstatusbar-h.html">qstatusbar.h</a>> -#include <<a href="qapplication-h.html">qapplication.h</a>> +#include <<a href="qbuttongroup-h.html">ntqbuttongroup.h</a>> +#include <<a href="qradiobutton-h.html">ntqradiobutton.h</a>> +#include <<a href="qlabel-h.html">ntqlabel.h</a>> +#include <<a href="qlistbox-h.html">ntqlistbox.h</a>> +#include <<a href="qcombobox-h.html">ntqcombobox.h</a>> +#include <<a href="qlabel-h.html">ntqlabel.h</a>> +#include <<a href="qhbox-h.html">ntqhbox.h</a>> +#include <<a href="qvbox-h.html">ntqvbox.h</a>> +#include <<a href="qaccel-h.html">ntqaccel.h</a>> +#include <<a href="qpopupmenu-h.html">ntqpopupmenu.h</a>> +#include <<a href="qmenubar-h.html">ntqmenubar.h</a>> +#include <<a href="qstatusbar-h.html">ntqstatusbar.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> #include "mywidget.h" -<a name="f525"></a>MyWidget::MyWidget( <a href="qwidget.html">TQWidget</a>* parent, const char* name ) - : <a href="qmainwindow.html">TQMainWindow</a>( parent, name ) +<a name="f525"></a>MyWidget::MyWidget( <a href="ntqwidget.html">TQWidget</a>* parent, const char* name ) + : <a href="ntqmainwindow.html">TQMainWindow</a>( parent, name ) { - <a href="qvbox.html">TQVBox</a>* central = new <a href="qvbox.html">TQVBox</a>(this); -<a name="x1923"></a> central-><a href="qframe.html#setMargin">setMargin</a>( 5 ); -<a name="x1924"></a> central-><a href="qhbox.html#setSpacing">setSpacing</a>( 5 ); - <a href="qmainwindow.html#setCentralWidget">setCentralWidget</a>(central); + <a href="ntqvbox.html">TQVBox</a>* central = new <a href="ntqvbox.html">TQVBox</a>(this); +<a name="x1923"></a> central-><a href="ntqframe.html#setMargin">setMargin</a>( 5 ); +<a name="x1924"></a> central-><a href="ntqhbox.html#setSpacing">setSpacing</a>( 5 ); + <a href="ntqmainwindow.html#setCentralWidget">setCentralWidget</a>(central); - <a href="qpopupmenu.html">TQPopupMenu</a>* file = new <a href="qpopupmenu.html">TQPopupMenu</a>(this); - file-><a href="qmenudata.html#insertItem">insertItem</a>( <a href="qobject.html#tr">tr</a>("E&xit"), qApp, SLOT(<a href="qapplication.html#quit">quit</a>()), -<a name="x1921"></a> TQAccel::<a href="qaccel.html#stringToKey">stringToKey</a>(<a href="qobject.html#tr">tr</a>("Ctrl+Q")) ); - <a href="qmainwindow.html#menuBar">menuBar</a>()->insertItem( <a href="qobject.html#tr">tr</a>("&File"), file ); + <a href="ntqpopupmenu.html">TQPopupMenu</a>* file = new <a href="ntqpopupmenu.html">TQPopupMenu</a>(this); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>( <a href="ntqobject.html#tr">tr</a>("E&xit"), qApp, SLOT(<a href="ntqapplication.html#quit">quit</a>()), +<a name="x1921"></a> TQAccel::<a href="ntqaccel.html#stringToKey">stringToKey</a>(<a href="ntqobject.html#tr">tr</a>("Ctrl+Q")) ); + <a href="ntqmainwindow.html#menuBar">menuBar</a>()->insertItem( <a href="ntqobject.html#tr">tr</a>("&File"), file ); - <a href="qwidget.html#setCaption">setCaption</a>( <a href="qobject.html#tr">tr</a>( "Internationalization Example" ) ); + <a href="ntqwidget.html#setCaption">setCaption</a>( <a href="ntqobject.html#tr">tr</a>( "Internationalization Example" ) ); - <a href="qstring.html">TQString</a> l; - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( <a href="qobject.html#tr">tr</a>("Language: English") ); + <a href="ntqstring.html">TQString</a> l; + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( <a href="ntqobject.html#tr">tr</a>("Language: English") ); - ( void )new <a href="qlabel.html">TQLabel</a>( <a href="qobject.html#tr">tr</a>( "The Main Window" ), central ); + ( void )new <a href="ntqlabel.html">TQLabel</a>( <a href="ntqobject.html#tr">tr</a>( "The Main Window" ), central ); - <a href="qbuttongroup.html">TQButtonGroup</a>* gbox = new <a href="qbuttongroup.html">TQButtonGroup</a>( 1, TQGroupBox::Horizontal, - <a href="qobject.html#tr">tr</a>( "View" ), central ); - (void)new <a href="qradiobutton.html">TQRadioButton</a>( <a href="qobject.html#tr">tr</a>( "Perspective" ), gbox ); - (void)new <a href="qradiobutton.html">TQRadioButton</a>( <a href="qobject.html#tr">tr</a>( "Isometric" ), gbox ); - (void)new <a href="qradiobutton.html">TQRadioButton</a>( <a href="qobject.html#tr">tr</a>( "Oblique" ), gbox ); + <a href="ntqbuttongroup.html">TQButtonGroup</a>* gbox = new <a href="ntqbuttongroup.html">TQButtonGroup</a>( 1, TQGroupBox::Horizontal, + <a href="ntqobject.html#tr">tr</a>( "View" ), central ); + (void)new <a href="ntqradiobutton.html">TQRadioButton</a>( <a href="ntqobject.html#tr">tr</a>( "Perspective" ), gbox ); + (void)new <a href="ntqradiobutton.html">TQRadioButton</a>( <a href="ntqobject.html#tr">tr</a>( "Isometric" ), gbox ); + (void)new <a href="ntqradiobutton.html">TQRadioButton</a>( <a href="ntqobject.html#tr">tr</a>( "Oblique" ), gbox ); initChoices(central); } @@ -141,14 +141,14 @@ static const char* choices[] = { void <a name="f526"></a>MyWidget::initChoices(TQWidget* parent) { - <a href="qlistbox.html">TQListBox</a>* lb = new <a href="qlistbox.html">TQListBox</a>( parent ); + <a href="ntqlistbox.html">TQListBox</a>* lb = new <a href="ntqlistbox.html">TQListBox</a>( parent ); for ( int i = 0; choices[i]; i++ ) -<a name="x1925"></a> lb-><a href="qlistbox.html#insertItem">insertItem</a>( <a href="qobject.html#tr">tr</a>( choices[i] ) ); +<a name="x1925"></a> lb-><a href="ntqlistbox.html#insertItem">insertItem</a>( <a href="ntqobject.html#tr">tr</a>( choices[i] ) ); } -<a name="x1927"></a>void MyWidget::<a href="qwidget.html#closeEvent">closeEvent</a>(TQCloseEvent* e) +<a name="x1927"></a>void MyWidget::<a href="ntqwidget.html#closeEvent">closeEvent</a>(TQCloseEvent* e) { - TQWidget::<a href="qwidget.html#closeEvent">closeEvent</a>(e); + TQWidget::<a href="ntqwidget.html#closeEvent">closeEvent</a>(e); emit closed(); } </pre> @@ -165,17 +165,17 @@ void <a name="f526"></a>MyWidget::initChoices(TQWidget* parent) ** *****************************************************************************/ -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qtranslator-h.html">qtranslator.h</a>> -#include <<a href="qfileinfo-h.html">qfileinfo.h</a>> -#include <<a href="qmessagebox-h.html">qmessagebox.h</a>> -#include <<a href="qcheckbox-h.html">qcheckbox.h</a>> -#include <<a href="qvbox-h.html">qvbox.h</a>> -#include <<a href="qlayout-h.html">qlayout.h</a>> -#include <<a href="qbuttongroup-h.html">qbuttongroup.h</a>> -#include <<a href="qpushbutton-h.html">qpushbutton.h</a>> -#include <<a href="qsignalmapper-h.html">qsignalmapper.h</a>> -#include <<a href="qtextcodec-h.html">qtextcodec.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qtranslator-h.html">ntqtranslator.h</a>> +#include <<a href="qfileinfo-h.html">ntqfileinfo.h</a>> +#include <<a href="qmessagebox-h.html">ntqmessagebox.h</a>> +#include <<a href="qcheckbox-h.html">ntqcheckbox.h</a>> +#include <<a href="qvbox-h.html">ntqvbox.h</a>> +#include <<a href="qlayout-h.html">ntqlayout.h</a>> +#include <<a href="qbuttongroup-h.html">ntqbuttongroup.h</a>> +#include <<a href="qpushbutton-h.html">ntqpushbutton.h</a>> +#include <<a href="qsignalmapper-h.html">ntqsignalmapper.h</a>> +#include <<a href="qtextcodec-h.html">ntqtextcodec.h</a>> #include <stdlib.h> #if defined(Q_OS_UNIX) @@ -186,42 +186,42 @@ void <a name="f526"></a>MyWidget::initChoices(TQWidget* parent) //#define USE_I18N_FONT -class TQVDialog : public <a href="qdialog.html">TQDialog</a> { +class TQVDialog : public <a href="ntqdialog.html">TQDialog</a> { public: TQVDialog(TQWidget *parent=0, const char *name=0, bool modal=FALSE, - WFlags f=0) : <a href="qdialog.html">TQDialog</a>(parent,name,modal,f) + WFlags f=0) : <a href="ntqdialog.html">TQDialog</a>(parent,name,modal,f) { <a href="qvboxlayout.html">TQVBoxLayout</a>* vb = new <a href="qvboxlayout.html">TQVBoxLayout</a>(this,8); -<a name="x1938"></a> vb-><a href="qlayout.html#setAutoAdd">setAutoAdd</a>(TRUE); +<a name="x1938"></a> vb-><a href="ntqlayout.html#setAutoAdd">setAutoAdd</a>(TRUE); hb = 0; - sm = new <a href="qsignalmapper.html">TQSignalMapper</a>(this); -<a name="x1946"></a> connect(sm,SIGNAL(<a href="qsignalmapper.html#mapped">mapped</a>(int)),this,SLOT(done(int))); + sm = new <a href="ntqsignalmapper.html">TQSignalMapper</a>(this); +<a name="x1946"></a> connect(sm,SIGNAL(<a href="ntqsignalmapper.html#mapped">mapped</a>(int)),this,SLOT(done(int))); } - void addButtons( const <a href="qstring.html">TQString</a>& cancel=TQString::null, - const <a href="qstring.html">TQString</a>& ok=TQString::null, - const <a href="qstring.html">TQString</a>& mid1=TQString::null, - const <a href="qstring.html">TQString</a>& mid2=TQString::null, - const <a href="qstring.html">TQString</a>& mid3=TQString::null) + void addButtons( const <a href="ntqstring.html">TQString</a>& cancel=TQString::null, + const <a href="ntqstring.html">TQString</a>& ok=TQString::null, + const <a href="ntqstring.html">TQString</a>& mid1=TQString::null, + const <a href="ntqstring.html">TQString</a>& mid2=TQString::null, + const <a href="ntqstring.html">TQString</a>& mid3=TQString::null) { -<a name="x1948"></a> addButton(ok.<a href="qstring.html#isNull">isNull</a>() ? TQObject::tr("OK") : ok, 1); - if ( !mid1.<a href="qstring.html#isNull">isNull</a>() ) addButton(mid1,2); - if ( !mid2.<a href="qstring.html#isNull">isNull</a>() ) addButton(mid2,3); - if ( !mid3.<a href="qstring.html#isNull">isNull</a>() ) addButton(mid3,4); - addButton(cancel.<a href="qstring.html#isNull">isNull</a>() ? TQObject::tr("Cancel") : cancel, 0); +<a name="x1948"></a> addButton(ok.<a href="ntqstring.html#isNull">isNull</a>() ? TQObject::tr("OK") : ok, 1); + if ( !mid1.<a href="ntqstring.html#isNull">isNull</a>() ) addButton(mid1,2); + if ( !mid2.<a href="ntqstring.html#isNull">isNull</a>() ) addButton(mid2,3); + if ( !mid3.<a href="ntqstring.html#isNull">isNull</a>() ) addButton(mid3,4); + addButton(cancel.<a href="ntqstring.html#isNull">isNull</a>() ? TQObject::tr("Cancel") : cancel, 0); } - void addButton( const <a href="qstring.html">TQString</a>& text, int result ) + void addButton( const <a href="ntqstring.html">TQString</a>& text, int result ) { if ( !hb ) - hb = new <a href="qhbox.html">TQHBox</a>(this); - <a href="qpushbutton.html">TQPushButton</a> *c = new <a href="qpushbutton.html">TQPushButton</a>(text, hb); -<a name="x1947"></a> sm-><a href="qsignalmapper.html#setMapping">setMapping</a>(c,result); -<a name="x1945"></a> connect(c,SIGNAL(<a href="qbutton.html#clicked">clicked</a>()),sm,SLOT(<a href="qsignalmapper.html#map">map</a>())); + hb = new <a href="ntqhbox.html">TQHBox</a>(this); + <a href="ntqpushbutton.html">TQPushButton</a> *c = new <a href="ntqpushbutton.html">TQPushButton</a>(text, hb); +<a name="x1947"></a> sm-><a href="ntqsignalmapper.html#setMapping">setMapping</a>(c,result); +<a name="x1945"></a> connect(c,SIGNAL(<a href="ntqbutton.html#clicked">clicked</a>()),sm,SLOT(<a href="ntqsignalmapper.html#map">map</a>())); } private: - <a href="qsignalmapper.html">TQSignalMapper</a> *sm; - <a href="qhbox.html">TQHBox</a> *hb; + <a href="ntqsignalmapper.html">TQSignalMapper</a> *sm; + <a href="ntqhbox.html">TQHBox</a> *hb; }; MyWidget* showLang(TQString lang) @@ -229,32 +229,32 @@ MyWidget* showLang(TQString lang) static TQTranslator *translator = 0; -<a name="x1934"></a> qApp-><a href="qapplication.html#setPalette">setPalette</a>(TQPalette(TQColor(220-rand()%64,220-rand()%64,220-rand()%64))); +<a name="x1934"></a> qApp-><a href="ntqapplication.html#setPalette">setPalette</a>(TQPalette(TQColor(220-rand()%64,220-rand()%64,220-rand()%64))); lang = "mywidget_" + lang + ".qm"; - <a href="qfileinfo.html">TQFileInfo</a> fi( lang ); + <a href="ntqfileinfo.html">TQFileInfo</a> fi( lang ); -<a name="x1937"></a> if ( !fi.<a href="qfileinfo.html#exists">exists</a>() ) { -<a name="x1940"></a> TQMessageBox::<a href="qmessagebox.html#warning">warning</a>( 0, "File error", +<a name="x1937"></a> if ( !fi.<a href="ntqfileinfo.html#exists">exists</a>() ) { +<a name="x1940"></a> TQMessageBox::<a href="ntqmessagebox.html#warning">warning</a>( 0, "File error", TQString("Cannot find translation for language: "+lang+ "\n(try eg. 'de', 'ko' or 'no')") ); return 0; } if ( translator ) { -<a name="x1932"></a> qApp-><a href="qapplication.html#removeTranslator">removeTranslator</a>( translator ); +<a name="x1932"></a> qApp-><a href="ntqapplication.html#removeTranslator">removeTranslator</a>( translator ); delete translator; } - translator = new <a href="qtranslator.html">TQTranslator</a>( 0 ); -<a name="x1950"></a> translator-><a href="qtranslator.html#load">load</a>( lang, "." ); -<a name="x1930"></a> qApp-><a href="qapplication.html#installTranslator">installTranslator</a>( translator ); + translator = new <a href="ntqtranslator.html">TQTranslator</a>( 0 ); +<a name="x1950"></a> translator-><a href="ntqtranslator.html#load">load</a>( lang, "." ); +<a name="x1930"></a> qApp-><a href="ntqapplication.html#installTranslator">installTranslator</a>( translator ); MyWidget *m = new MyWidget; -<a name="x1951"></a> m-><a href="qwidget.html#setCaption">setCaption</a>("TQt Example - <a href="i18n.html#i18n">i18n</a> - " + m-><a href="qwidget.html#caption">caption</a>() ); +<a name="x1951"></a> m-><a href="ntqwidget.html#setCaption">setCaption</a>("TQt Example - <a href="i18n.html#i18n">i18n</a> - " + m-><a href="ntqwidget.html#caption">caption</a>() ); return m; } int main( int argc, char** argv ) { - <a href="qapplication.html">TQApplication</a> app( argc, argv ); + <a href="ntqapplication.html">TQApplication</a> app( argc, argv ); const char* qm[]= { "ar", "cs", "de", "el", "en", "eo", "fr", "it", "jp", "ko", "no", "ru", "zh", 0 }; @@ -263,7 +263,7 @@ int main( int argc, char** argv ) srand( getpid() << 2 ); #endif - <a href="qstring.html">TQString</a> lang; + <a href="ntqstring.html">TQString</a> lang; if ( argc == 2 ) lang = argv[1]; @@ -274,28 +274,28 @@ int main( int argc, char** argv ) if ( lang == "all" ) { r = 2; } else { - <a href="qbuttongroup.html">TQButtonGroup</a> *bg = new <a href="qbuttongroup.html">TQButtonGroup</a>(4,TQt::Vertical,"Choose Locales",&dlg); -<a name="x1949"></a> <a href="qstring.html">TQString</a> loc = TQTextCodec::<a href="qtextcodec.html#locale">locale</a>(); + <a href="ntqbuttongroup.html">TQButtonGroup</a> *bg = new <a href="ntqbuttongroup.html">TQButtonGroup</a>(4,TQt::Vertical,"Choose Locales",&dlg); +<a name="x1949"></a> <a href="ntqstring.html">TQString</a> loc = TQTextCodec::<a href="ntqtextcodec.html#locale">locale</a>(); for ( int i=0; qm[i]; i++ ) { - qmb[i] = new <a href="qcheckbox.html">TQCheckBox</a>((const char*)qm[i],bg); + qmb[i] = new <a href="ntqcheckbox.html">TQCheckBox</a>((const char*)qm[i],bg); qmb[i]->setChecked( loc == qm[i] ); } dlg.addButtons("Cancel","OK","All"); -<a name="x1936"></a> r = dlg.<a href="qdialog.html#exec">exec</a>(); +<a name="x1936"></a> r = dlg.<a href="ntqdialog.html#exec">exec</a>(); } if ( r ) { -<a name="x1928"></a> <a href="qrect.html">TQRect</a> screen = qApp-><a href="qapplication.html#desktop">desktop</a>()->availableGeometry(); - bool tight = screen.<a href="qrect.html#width">width</a>() < 1024; -<a name="x1942"></a> int x=screen.<a href="qrect.html#left">left</a>()+5; - int y=screen.<a href="qrect.html#top">top</a>()+25; +<a name="x1928"></a> <a href="ntqrect.html">TQRect</a> screen = qApp-><a href="ntqapplication.html#desktop">desktop</a>()->availableGeometry(); + bool tight = screen.<a href="ntqrect.html#width">width</a>() < 1024; +<a name="x1942"></a> int x=screen.<a href="ntqrect.html#left">left</a>()+5; + int y=screen.<a href="ntqrect.html#top">top</a>()+25; for ( int i=0; qm[i]; i++ ) { if ( r == 2 || qmb[i]->isChecked() ) { MyWidget* w = showLang((const char*)qm[i]); if( w == 0 ) exit( 0 ); - TQObject::<a href="qobject.html#connect">connect</a>(w, SIGNAL(closed()), qApp, SLOT(<a href="qapplication.html#quit">quit</a>())); -<a name="x1953"></a> w-><a href="qwidget.html#setGeometry">setGeometry</a>(x,y,197,356); - w-><a href="qwidget.html#show">show</a>(); + TQObject::<a href="ntqobject.html#connect">connect</a>(w, SIGNAL(closed()), qApp, SLOT(<a href="ntqapplication.html#quit">quit</a>())); +<a name="x1953"></a> w-><a href="ntqwidget.html#setGeometry">setGeometry</a>(x,y,197,356); + w-><a href="ntqwidget.html#show">show</a>(); if ( tight ) { x += 8; y += 8; @@ -312,11 +312,11 @@ int main( int argc, char** argv ) exit( 0 ); } } else { - <a href="qstring.html">TQString</a> lang = argv[1]; - <a href="qwidget.html">TQWidget</a>* m = showLang(lang); - app.<a href="qapplication.html#setMainWidget">setMainWidget</a>( m ); - m-><a href="qwidget.html#setCaption">setCaption</a>("TQt Example - i18n"); - m-><a href="qwidget.html#show">show</a>(); + <a href="ntqstring.html">TQString</a> lang = argv[1]; + <a href="ntqwidget.html">TQWidget</a>* m = showLang(lang); + app.<a href="ntqapplication.html#setMainWidget">setMainWidget</a>( m ); + m-><a href="ntqwidget.html#setCaption">setCaption</a>("TQt Example - i18n"); + m-><a href="ntqwidget.html#show">show</a>(); } #ifdef USE_I18N_FONT @@ -324,7 +324,7 @@ int main( int argc, char** argv ) #endif // While we run "all", kill them all - return app.<a href="qapplication.html#exec">exec</a>(); + return app.<a href="ntqapplication.html#exec">exec</a>(); } </pre> |