diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
commit | d796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch) | |
tree | 6e3dcca4f77e20ec8966c666aac7c35bd4704053 /examples/i18n/mywidget.cpp | |
download | tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip |
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'examples/i18n/mywidget.cpp')
-rw-r--r-- | examples/i18n/mywidget.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/examples/i18n/mywidget.cpp b/examples/i18n/mywidget.cpp new file mode 100644 index 000000000..94e21144e --- /dev/null +++ b/examples/i18n/mywidget.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of an example program for TQt. This example +** program may be used, distributed and modified without limitation. +** +*****************************************************************************/ + +#include <qbuttongroup.h> +#include <qradiobutton.h> +#include <qlabel.h> +#include <qlistbox.h> +#include <qcombobox.h> +#include <qlabel.h> +#include <qhbox.h> +#include <qvbox.h> +#include <qaccel.h> +#include <qpopupmenu.h> +#include <qmenubar.h> +#include <qstatusbar.h> +#include <qapplication.h> + +#include "mywidget.h" + +MyWidget::MyWidget( TQWidget* parent, const char* name ) + : TQMainWindow( parent, name ) +{ + TQVBox* central = new TQVBox(this); + central->setMargin( 5 ); + central->setSpacing( 5 ); + setCentralWidget(central); + + TQPopupMenu* file = new TQPopupMenu(this); + file->insertItem( tr("E&xit"), qApp, SLOT(tquit()), + TQAccel::stringToKey(tr("Ctrl+Q")) ); + menuBar()->insertItem( tr("&File"), file ); + + setCaption( tr( "Internationalization Example" ) ); + + TQString l; + statusBar()->message( tr("Language: English") ); + + ( void )new TQLabel( tr( "The Main Window" ), central ); + + TQButtonGroup* gbox = new TQButtonGroup( 1, TQGroupBox::Horizontal, + tr( "View" ), central ); + (void)new TQRadioButton( tr( "Perspective" ), gbox ); + (void)new TQRadioButton( tr( "Isometric" ), gbox ); + (void)new TQRadioButton( tr( "Oblique" ), gbox ); + + initChoices(central); +} + +static const char* choices[] = { + QT_TRANSLATE_NOOP( "MyWidget", "First" ), + QT_TRANSLATE_NOOP( "MyWidget", "Second" ), + QT_TRANSLATE_NOOP( "MyWidget", "Third" ), + 0 +}; + +void MyWidget::initChoices(TQWidget* parent) +{ + TQListBox* lb = new TQListBox( parent ); + for ( int i = 0; choices[i]; i++ ) + lb->insertItem( tr( choices[i] ) ); +} + +void MyWidget::closeEvent(TQCloseEvent* e) +{ + TQWidget::closeEvent(e); + emit closed(); +} |