diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp')
-rw-r--r-- | languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp index 841f88d4..973aee2c 100644 --- a/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp +++ b/languages/cpp/app_templates/cmakeqt3app/cmakeqt3app.cpp @@ -2,120 +2,120 @@ #include "%{APPNAMELC}.h" -#include <qimage.h> -#include <qpixmap.h> -#include <qtoolbar.h> -#include <qtoolbutton.h> -#include <qpopupmenu.h> -#include <qmenubar.h> -#include <qtextedit.h> -#include <qfile.h> -#include <qfiledialog.h> -#include <qstatusbar.h> -#include <qmessagebox.h> -#include <qprinter.h> -#include <qapplication.h> -#include <qaccel.h> -#include <qtextstream.h> -#include <qpainter.h> -#include <qpaintdevicemetrics.h> -#include <qwhatsthis.h> +#include <tqimage.h> +#include <tqpixmap.h> +#include <tqtoolbar.h> +#include <tqtoolbutton.h> +#include <tqpopupmenu.h> +#include <tqmenubar.h> +#include <tqtextedit.h> +#include <tqfile.h> +#include <tqfiledialog.h> +#include <tqstatusbar.h> +#include <tqmessagebox.h> +#include <tqprinter.h> +#include <tqapplication.h> +#include <tqaccel.h> +#include <tqtextstream.h> +#include <tqpainter.h> +#include <tqpaintdevicemetrics.h> +#include <tqwhatsthis.h> #include "filesave.xpm" #include "fileopen.xpm" #include "fileprint.xpm" %{APPNAME}::%{APPNAME}() - : QMainWindow( 0, "%{APPNAME}", WDestructiveClose ) + : TQMainWindow( 0, "%{APPNAME}", WDestructiveClose ) { printer = new QPrinter; - QPixmap openIcon, saveIcon, printIcon; + TQPixmap openIcon, saveIcon, printIcon; - QToolBar * fileTools = new QToolBar( this, "file operations" ); + TQToolBar * fileTools = new TQToolBar( this, "file operations" ); fileTools->setLabel( tr("File Operations") ); - openIcon = QPixmap( fileopen ); - QToolButton * fileOpen - = new QToolButton( openIcon, tr("Open File"), QString::null, - this, SLOT(choose()), fileTools, "open file" ); + openIcon = TQPixmap( fileopen ); + TQToolButton * fileOpen + = new TQToolButton( openIcon, tr("Open File"), TQString::null, + this, TQT_SLOT(choose()), fileTools, "open file" ); - saveIcon = QPixmap( filesave ); - QToolButton * fileSave - = new QToolButton( saveIcon, tr("Save File"), QString::null, - this, SLOT(save()), fileTools, "save file" ); + saveIcon = TQPixmap( filesave ); + TQToolButton * fileSave + = new TQToolButton( saveIcon, tr("Save File"), TQString::null, + this, TQT_SLOT(save()), fileTools, "save file" ); - printIcon = QPixmap( fileprint ); - QToolButton * filePrint - = new QToolButton( printIcon, tr("Print File"), QString::null, - this, SLOT(print()), fileTools, "print file" ); + printIcon = TQPixmap( fileprint ); + TQToolButton * filePrint + = new TQToolButton( printIcon, tr("Print File"), TQString::null, + this, TQT_SLOT(print()), fileTools, "print file" ); - (void)QWhatsThis::whatsThisButton( fileTools ); + (void)TQWhatsThis::whatsThisButton( fileTools ); - QString fileOpenText = tr("<p><img source=\"fileopen\"> " + TQString fileOpenText = tr("<p><img source=\"fileopen\"> " "Click this button to open a <em>new file</em>. <br>" "You can also select the <b>Open</b> command " "from the <b>File</b> menu.</p>"); - QWhatsThis::add( fileOpen, fileOpenText ); + TQWhatsThis::add( fileOpen, fileOpenText ); - QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon ); + TQMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon ); - QString fileSaveText = tr("<p>Click this button to save the file you " + TQString fileSaveText = tr("<p>Click this button to save the file you " "are editing. You will be prompted for a file name.\n" "You can also select the <b>Save</b> command " "from the <b>File</b> menu.</p>"); - QWhatsThis::add( fileSave, fileSaveText ); + TQWhatsThis::add( fileSave, fileSaveText ); - QString filePrintText = tr("Click this button to print the file you " + TQString filePrintText = tr("Click this button to print the file you " "are editing.\n You can also select the Print " "command from the File menu."); - QWhatsThis::add( filePrint, filePrintText ); + TQWhatsThis::add( filePrint, filePrintText ); - QPopupMenu * file = new QPopupMenu( this ); + TQPopupMenu * file = new TQPopupMenu( this ); menuBar()->insertItem( tr("&File"), file ); - file->insertItem( tr("&New"), this, SLOT(newDoc()), CTRL+Key_N ); + file->insertItem( tr("&New"), this, TQT_SLOT(newDoc()), CTRL+Key_N ); int id; id = file->insertItem( openIcon, tr("&Open..."), - this, SLOT(choose()), CTRL+Key_O ); + this, TQT_SLOT(choose()), CTRL+Key_O ); file->setWhatsThis( id, fileOpenText ); id = file->insertItem( saveIcon, tr("&Save"), - this, SLOT(save()), CTRL+Key_S ); + this, TQT_SLOT(save()), CTRL+Key_S ); file->setWhatsThis( id, fileSaveText ); - id = file->insertItem( tr("Save &As..."), this, SLOT(saveAs()) ); + id = file->insertItem( tr("Save &As..."), this, TQT_SLOT(saveAs()) ); file->setWhatsThis( id, fileSaveText ); file->insertSeparator(); id = file->insertItem( printIcon, tr("&Print..."), - this, SLOT(print()), CTRL+Key_P ); + this, TQT_SLOT(print()), CTRL+Key_P ); file->setWhatsThis( id, filePrintText ); file->insertSeparator(); - file->insertItem( tr("&Close"), this, SLOT(close()), CTRL+Key_W ); + file->insertItem( tr("&Close"), this, TQT_SLOT(close()), CTRL+Key_W ); - file->insertItem( tr("&Quit"), qApp, SLOT( closeAllWindows() ), CTRL+Key_Q ); + file->insertItem( tr("&Quit"), qApp, TQT_SLOT( closeAllWindows() ), CTRL+Key_Q ); menuBar()->insertSeparator(); - QPopupMenu * help = new QPopupMenu( this ); + TQPopupMenu * help = new TQPopupMenu( this ); menuBar()->insertItem( tr("&Help"), help ); - help->insertItem( tr("&About"), this, SLOT(about()), Key_F1 ); - help->insertItem( tr("About &Qt"), this, SLOT(aboutQt()) ); + help->insertItem( tr("&About"), this, TQT_SLOT(about()), Key_F1 ); + help->insertItem( tr("About &Qt"), this, TQT_SLOT(aboutQt()) ); help->insertSeparator(); - help->insertItem( tr("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1 ); + help->insertItem( tr("What's &This"), this, TQT_SLOT(whatsThis()), SHIFT+Key_F1 ); - e = new QTextEdit( this, "editor" ); + e = new TQTextEdit( this, "editor" ); e->setFocus(); setCentralWidget( e ); statusBar()->message( tr("Ready"), 2000 ); @@ -140,7 +140,7 @@ void %{APPNAME}::newDoc() void %{APPNAME}::choose() { - QString fn = QFileDialog::getOpenFileName( QString::null, QString::null, + TQString fn = TQFileDialog::getOpenFileName( TQString::null, TQString::null, this); if ( !fn.isEmpty() ) load( fn ); @@ -149,13 +149,13 @@ void %{APPNAME}::choose() } -void %{APPNAME}::load( const QString &fileName ) +void %{APPNAME}::load( const TQString &fileName ) { - QFile f( fileName ); + TQFile f( fileName ); if ( !f.open( IO_ReadOnly ) ) return; - QTextStream ts( &f ); + TQTextStream ts( &f ); e->setText( ts.read() ); e->setModified( FALSE ); setCaption( fileName ); @@ -170,15 +170,15 @@ void %{APPNAME}::save() return; } - QString text = e->text(); - QFile f( filename ); + TQString text = e->text(); + TQFile f( filename ); if ( !f.open( IO_WriteOnly ) ) { statusBar()->message( tr("Could not write to %1").arg(filename), 2000 ); return; } - QTextStream t( &f ); + TQTextStream t( &f ); t << text; f.close(); @@ -192,7 +192,7 @@ void %{APPNAME}::save() void %{APPNAME}::saveAs() { - QString fn = QFileDialog::getSaveFileName( QString::null, QString::null, + TQString fn = TQFileDialog::getSaveFileName( TQString::null, TQString::null, this ); if ( !fn.isEmpty() ) { filename = fn; @@ -205,25 +205,25 @@ void %{APPNAME}::saveAs() void %{APPNAME}::print() { - // ###### Rewrite to use QSimpleRichText to print here as well + // ###### Rewrite to use TQSimpleRichText to print here as well const int Margin = 10; int pageNo = 1; if ( printer->setup(this) ) { // printer dialog statusBar()->message( tr("Printing...") ); - QPainter p; + TQPainter p; if( !p.begin( printer ) ) // paint on printer return; p.setFont( e->font() ); int yPos = 0; // y-position for each line - QFontMetrics fm = p.fontMetrics(); - QPaintDeviceMetrics metrics( printer ); // need width/height + TQFontMetrics fm = p.fontMetrics(); + TQPaintDeviceMetrics metrics( printer ); // need width/height // of printer surface for( int i = 0 ; i < e->lines() ; i++ ) { if ( Margin + yPos > metrics.height() - Margin ) { - QString msg( "Printing (page " ); - msg += QString::number( ++pageNo ); + TQString msg( "Printing (page " ); + msg += TQString::number( ++pageNo ); msg += ")..."; statusBar()->message( msg ); printer->newPage(); // no more room on this page @@ -242,14 +242,14 @@ void %{APPNAME}::print() } } -void %{APPNAME}::closeEvent( QCloseEvent* ce ) +void %{APPNAME}::closeEvent( TQCloseEvent* ce ) { if ( !e->isModified() ) { ce->accept(); return; } - switch( QMessageBox::information( this, tr("Qt Application Example"), + switch( TQMessageBox::information( this, tr("Qt Application Example"), tr("Do you want to save the changes" " to the document?"), tr("Yes"), tr("No"), tr("Cancel"), @@ -271,13 +271,13 @@ void %{APPNAME}::closeEvent( QCloseEvent* ce ) void %{APPNAME}::about() { - QMessageBox::about( this, tr("Qt Application Example"), + TQMessageBox::about( this, tr("Qt Application Example"), tr("This example demonstrates simple use of " - "QMainWindow,\nQMenuBar and QToolBar.")); + "TQMainWindow,\nQMenuBar and TQToolBar.")); } void %{APPNAME}::aboutQt() { - QMessageBox::aboutQt( this, tr("Qt Application Example") ); + TQMessageBox::aboutQt( this, tr("Qt Application Example") ); } |