diff options
Diffstat (limited to 'example')
-rw-r--r-- | example/application.cpp | 142 | ||||
-rw-r--r-- | example/application.h | 15 | ||||
-rw-r--r-- | example/main.cpp | 10 |
3 files changed, 84 insertions, 83 deletions
diff --git a/example/application.cpp b/example/application.cpp index a4cca36..6a2b548 100644 --- a/example/application.cpp +++ b/example/application.cpp @@ -3,129 +3,129 @@ ** ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. ** -** This file is part of an example program for Qt. This example +** This file is part of an example program for TQt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ #include "application.h" -#include <qimage.h> -#include <qpixmap.h> -#include <qtoolbar.h> -#include <qtoolbutton.h> -#include <qpopupmenu.h> -#include <qmenubar.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 <qsimplerichtext.h> - -#include <qextscintilla.h> -#include <qextscintillaprinter.h> +#include <tqimage.h> +#include <tqpixmap.h> +#include <tqtoolbar.h> +#include <tqtoolbutton.h> +#include <tqpopupmenu.h> +#include <tqmenubar.h> +#include <tqfile.h> +#include <tqfiledialog.h> +#include <statusbar.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 <tqsimplerichtext.h> + +#include <tqextscintilla.h> +#include <tqextscintillaprinter.h> #include "filesave.xpm" #include "fileopen.xpm" #include "fileprint.xpm" ApplicationWindow::ApplicationWindow() - : QMainWindow( 0, "example application main window", WDestructiveClose | WGroupLeader ) + : TQMainWindow( 0, "example application main window", WDestructiveClose | WGroupLeader ) { - printer = new QextScintillaPrinter( QPrinter::HighResolution ); - QPixmap openIcon, saveIcon, printIcon; + printer = new QextScintillaPrinter( TQPrinter::HighResolution ); + TQPixmap openIcon, saveIcon, printIcon; - QToolBar * fileTools = new QToolBar( this, "file operations" ); + TQToolBar * fileTools = new TQToolBar( this, "file operations" ); fileTools->setLabel( "File Operations" ); - openIcon = QPixmap( fileopen ); - QToolButton * fileOpen - = new QToolButton( openIcon, "Open File", QString::null, - this, SLOT(choose()), fileTools, "open file" ); + openIcon = TQPixmap( fileopen ); + TQToolButton * fileOpen + = new TQToolButton( openIcon, "Open File", TQString(), + this, TQT_SLOT(choose()), fileTools, "open file" ); - saveIcon = QPixmap( filesave ); - QToolButton * fileSave - = new QToolButton( saveIcon, "Save File", QString::null, - this, SLOT(save()), fileTools, "save file" ); + saveIcon = TQPixmap( filesave ); + TQToolButton * fileSave + = new TQToolButton( saveIcon, "Save File", TQString(), + this, TQT_SLOT(save()), fileTools, "save file" ); - printIcon = QPixmap( fileprint ); - QToolButton * filePrint - = new QToolButton( printIcon, "Print File", QString::null, - this, SLOT(print()), fileTools, "print file" ); + printIcon = TQPixmap( fileprint ); + TQToolButton * filePrint + = new TQToolButton( printIcon, "Print File", TQString(), + this, TQT_SLOT(print()), fileTools, "print file" ); - (void)QWhatsThis::whatsThisButton( fileTools ); + (void)TQWhatsThis::whatsThisButton( fileTools ); const char * fileOpenText = "<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 ); const char * fileSaveText = "<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 ); const char * filePrintText = "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( "&File", file ); - file->insertItem( "&New", this, SLOT(newDoc()), CTRL+Key_N ); + file->insertItem( "&New", this, TQT_SLOT(newDoc()), CTRL+Key_N ); int id; id = file->insertItem( openIcon, "&Open...", - this, SLOT(choose()), CTRL+Key_O ); + this, TQT_SLOT(choose()), CTRL+Key_O ); file->setWhatsThis( id, fileOpenText ); id = file->insertItem( saveIcon, "&Save", - this, SLOT(save()), CTRL+Key_S ); + this, TQT_SLOT(save()), CTRL+Key_S ); file->setWhatsThis( id, fileSaveText ); - id = file->insertItem( "Save &As...", this, SLOT(saveAs()) ); + id = file->insertItem( "Save &As...", this, TQT_SLOT(saveAs()) ); file->setWhatsThis( id, fileSaveText ); file->insertSeparator(); id = file->insertItem( printIcon, "&Print...", - this, SLOT(print()), CTRL+Key_P ); + this, TQT_SLOT(print()), CTRL+Key_P ); file->setWhatsThis( id, filePrintText ); file->insertSeparator(); - file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_W ); + file->insertItem( "&Close", this, TQT_SLOT(close()), CTRL+Key_W ); - file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q ); + file->insertItem( "&Quit", tqApp, TQT_SLOT( closeAllWindows() ), CTRL+Key_Q ); menuBar()->insertSeparator(); - QPopupMenu * help = new QPopupMenu( this ); + TQPopupMenu * help = new TQPopupMenu( this ); menuBar()->insertItem( "&Help", help ); - help->insertItem( "&About", this, SLOT(about()), Key_F1 ); - help->insertItem( "About &Qt", this, SLOT(aboutQt()) ); + help->insertItem( "&About", this, TQT_SLOT(about()), Key_F1 ); + help->insertItem( "About &TQt", this, TQT_SLOT(aboutTQt()) ); help->insertSeparator(); - help->insertItem( "What's &This", this, SLOT(whatsThis()), SHIFT+Key_F1 ); + help->insertItem( "What's &This", this, TQT_SLOT(whatsThis()), SHIFT+Key_F1 ); e = new QextScintilla( this, "editor" ); e->setFocus(); @@ -146,13 +146,13 @@ ApplicationWindow::~ApplicationWindow() void ApplicationWindow::newDoc() { ApplicationWindow *ed = new ApplicationWindow; - ed->setCaption("QScintilla Example - Application"); + ed->setCaption("TQScintilla Example - Application"); ed->show(); } void ApplicationWindow::choose() { - QString fn = QFileDialog::getOpenFileName( QString::null, QString::null, + TQString fn = TQFileDialog::getOpenFileName( TQString(), TQString(), this); if ( !fn.isEmpty() ) load( fn ); @@ -161,13 +161,13 @@ void ApplicationWindow::choose() } -void ApplicationWindow::load( const QString &fileName ) +void ApplicationWindow::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 ); @@ -182,15 +182,15 @@ void ApplicationWindow::save() return; } - QString text = e->text(); - QFile f( filename ); + TQString text = e->text(); + TQFile f( filename ); if ( !f.open( IO_WriteOnly ) ) { - statusBar()->message( QString("Could not write to %1").arg(filename), + statusBar()->message( TQString("Could not write to %1").tqarg(filename), 2000 ); return; } - QTextStream t( &f ); + TQTextStream t( &f ); t << text; f.close(); @@ -198,13 +198,13 @@ void ApplicationWindow::save() setCaption( filename ); - statusBar()->message( QString( "File %1 saved" ).arg( filename ), 2000 ); + statusBar()->message( TQString( "File %1 saved" ).tqarg( filename ), 2000 ); } void ApplicationWindow::saveAs() { - QString fn = QFileDialog::getSaveFileName( QString::null, QString::null, + TQString fn = TQFileDialog::getSaveFileName( TQString(), TQString(), this ); if ( !fn.isEmpty() ) { filename = fn; @@ -230,14 +230,14 @@ void ApplicationWindow::print() } } -void ApplicationWindow::closeEvent( QCloseEvent* ce ) +void ApplicationWindow::closeEvent( TQCloseEvent* ce ) { if ( !e->isModified() ) { ce->accept(); return; } - switch( QMessageBox::information( this, "QScintilla Application Example", + switch( TQMessageBox::information( this, "TQScintilla Application Example", "Do you want to save the changes" " to the document?", "Yes", "No", "Cancel", @@ -259,13 +259,13 @@ void ApplicationWindow::closeEvent( QCloseEvent* ce ) void ApplicationWindow::about() { - QMessageBox::about( this, "QScintilla Application Example", + TQMessageBox::about( this, "TQScintilla Application Example", "This example demonstrates a simple use of " "QextScintilla and QextScintillaPrinter."); } -void ApplicationWindow::aboutQt() +void ApplicationWindow::aboutTQt() { - QMessageBox::aboutQt( this, "QScintilla Application Example" ); + TQMessageBox::aboutTQt( this, "TQScintilla Application Example" ); } diff --git a/example/application.h b/example/application.h index 6f48d41..a04ed15 100644 --- a/example/application.h +++ b/example/application.h @@ -3,7 +3,7 @@ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** -** This file is part of an example program for Qt. This example +** This file is part of an example program for TQt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ @@ -11,37 +11,38 @@ #ifndef APPLICATION_H #define APPLICATION_H -#include <qmainwindow.h> +#include <tqmainwindow.h> class QextScintilla; class QextScintillaPrinter; -class ApplicationWindow: public QMainWindow +class ApplicationWindow: public TQMainWindow { Q_OBJECT + TQ_OBJECT public: ApplicationWindow(); ~ApplicationWindow(); protected: - void closeEvent( QCloseEvent* ); + void closeEvent( TQCloseEvent* ); private slots: void newDoc(); void choose(); - void load( const QString &fileName ); + void load( const TQString &fileName ); void save(); void saveAs(); void print(); void about(); - void aboutQt(); + void aboutTQt(); private: QextScintillaPrinter *printer; QextScintilla *e; - QString filename; + TQString filename; }; diff --git a/example/main.cpp b/example/main.cpp index 3c2722c..a24a49f 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -3,19 +3,19 @@ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** -** This file is part of an example program for Qt. This example +** This file is part of an example program for TQt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ -#include <qapplication.h> +#include <tqapplication.h> #include "application.h" int main( int argc, char ** argv ) { - QApplication a( argc, argv ); + TQApplication a( argc, argv ); ApplicationWindow *mw = new ApplicationWindow(); - mw->setCaption( "QScintilla Example - Application" ); + mw->setCaption( "TQScintilla Example - Application" ); mw->show(); - a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); + a.connect( &a, TQT_SIGNAL(lastWindowClosed()), &a, TQT_SLOT(quit()) ); return a.exec(); } |