diff options
Diffstat (limited to 'doc/html/simple-application-example.html')
-rw-r--r-- | doc/html/simple-application-example.html | 246 |
1 files changed, 123 insertions, 123 deletions
diff --git a/doc/html/simple-application-example.html b/doc/html/simple-application-example.html index fd7877e36..1fe091b92 100644 --- a/doc/html/simple-application-example.html +++ b/doc/html/simple-application-example.html @@ -53,11 +53,11 @@ this example. #ifndef APPLICATION_H #define APPLICATION_H -#include <<a href="qmainwindow-h.html">qmainwindow.h</a>> +#include <<a href="qmainwindow-h.html">ntqmainwindow.h</a>> class TQTextEdit; -class ApplicationWindow: public <a href="qmainwindow.html">TQMainWindow</a> +class ApplicationWindow: public <a href="ntqmainwindow.html">TQMainWindow</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> @@ -71,7 +71,7 @@ protected: private slots: void newDoc(); void choose(); - void load( const <a href="qstring.html">TQString</a> &fileName ); + void load( const <a href="ntqstring.html">TQString</a> &fileName ); void save(); void saveAs(); void print(); @@ -80,9 +80,9 @@ private slots: void aboutTQt(); private: - <a href="qprinter.html">TQPrinter</a> *printer; - <a href="qtextedit.html">TQTextEdit</a> *e; - <a href="qstring.html">TQString</a> filename; + <a href="ntqprinter.html">TQPrinter</a> *printer; + <a href="ntqtextedit.html">TQTextEdit</a> *e; + <a href="ntqstring.html">TQString</a> filename; }; @@ -103,52 +103,52 @@ private: #include "application.h" -#include <<a href="qimage-h.html">qimage.h</a>> -#include <<a href="qpixmap-h.html">qpixmap.h</a>> -#include <<a href="qtoolbar-h.html">qtoolbar.h</a>> -#include <<a href="qtoolbutton-h.html">qtoolbutton.h</a>> -#include <<a href="qpopupmenu-h.html">qpopupmenu.h</a>> -#include <<a href="qmenubar-h.html">qmenubar.h</a>> -#include <<a href="qtextedit-h.html">qtextedit.h</a>> -#include <<a href="qfile-h.html">qfile.h</a>> -#include <<a href="qfiledialog-h.html">qfiledialog.h</a>> -#include <<a href="qstatusbar-h.html">qstatusbar.h</a>> -#include <<a href="qmessagebox-h.html">qmessagebox.h</a>> -#include <<a href="qprinter-h.html">qprinter.h</a>> -#include <<a href="qapplication-h.html">qapplication.h</a>> -#include <<a href="qaccel-h.html">qaccel.h</a>> -#include <<a href="qtextstream-h.html">qtextstream.h</a>> -#include <<a href="qpainter-h.html">qpainter.h</a>> -#include <<a href="qpaintdevicemetrics-h.html">qpaintdevicemetrics.h</a>> -#include <<a href="qwhatsthis-h.html">qwhatsthis.h</a>> -#include <<a href="qsimplerichtext-h.html">qsimplerichtext.h</a>> +#include <<a href="qimage-h.html">ntqimage.h</a>> +#include <<a href="qpixmap-h.html">ntqpixmap.h</a>> +#include <<a href="qtoolbar-h.html">ntqtoolbar.h</a>> +#include <<a href="qtoolbutton-h.html">ntqtoolbutton.h</a>> +#include <<a href="qpopupmenu-h.html">ntqpopupmenu.h</a>> +#include <<a href="qmenubar-h.html">ntqmenubar.h</a>> +#include <<a href="qtextedit-h.html">ntqtextedit.h</a>> +#include <<a href="qfile-h.html">ntqfile.h</a>> +#include <<a href="qfiledialog-h.html">ntqfiledialog.h</a>> +#include <<a href="qstatusbar-h.html">ntqstatusbar.h</a>> +#include <<a href="qmessagebox-h.html">ntqmessagebox.h</a>> +#include <<a href="qprinter-h.html">ntqprinter.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> +#include <<a href="qaccel-h.html">ntqaccel.h</a>> +#include <<a href="qtextstream-h.html">ntqtextstream.h</a>> +#include <<a href="qpainter-h.html">ntqpainter.h</a>> +#include <<a href="qpaintdevicemetrics-h.html">ntqpaintdevicemetrics.h</a>> +#include <<a href="qwhatsthis-h.html">ntqwhatsthis.h</a>> +#include <<a href="qsimplerichtext-h.html">ntqsimplerichtext.h</a>> #include "filesave.xpm" #include "fileopen.xpm" #include "fileprint.xpm" <a name="f459"></a>ApplicationWindow::ApplicationWindow() - : <a href="qmainwindow.html">TQMainWindow</a>( 0, "example application main window", WDestructiveClose | WGroupLeader ) + : <a href="ntqmainwindow.html">TQMainWindow</a>( 0, "example application main window", WDestructiveClose | WGroupLeader ) { - printer = new <a href="qprinter.html">TQPrinter</a>( TQPrinter::HighResolution ); - <a href="qpixmap.html">TQPixmap</a> openIcon, saveIcon, printIcon; + printer = new <a href="ntqprinter.html">TQPrinter</a>( TQPrinter::HighResolution ); + <a href="ntqpixmap.html">TQPixmap</a> openIcon, saveIcon, printIcon; - <a href="qtoolbar.html">TQToolBar</a> * fileTools = new <a href="qtoolbar.html">TQToolBar</a>( this, "file operations" ); -<a name="x1590"></a> fileTools-><a href="qtoolbar.html#setLabel">setLabel</a>( "File Operations" ); + <a href="ntqtoolbar.html">TQToolBar</a> * fileTools = new <a href="ntqtoolbar.html">TQToolBar</a>( this, "file operations" ); +<a name="x1590"></a> fileTools-><a href="ntqtoolbar.html#setLabel">setLabel</a>( "File Operations" ); openIcon = TQPixmap( fileopen ); TQToolButton * fileOpen - = new <a href="qtoolbutton.html">TQToolButton</a>( openIcon, "Open File", <a href="qstring.html#TQString-null">TQString::null</a>, + = new <a href="ntqtoolbutton.html">TQToolButton</a>( openIcon, "Open File", <a href="ntqstring.html#TQString-null">TQString::null</a>, this, SLOT(choose()), fileTools, "open file" ); saveIcon = TQPixmap( filesave ); TQToolButton * fileSave - = new <a href="qtoolbutton.html">TQToolButton</a>( saveIcon, "Save File", TQString::null, + = new <a href="ntqtoolbutton.html">TQToolButton</a>( saveIcon, "Save File", TQString::null, this, SLOT(save()), fileTools, "save file" ); printIcon = TQPixmap( fileprint ); TQToolButton * filePrint - = new <a href="qtoolbutton.html">TQToolButton</a>( printIcon, "Print File", TQString::null, + = new <a href="ntqtoolbutton.html">TQToolButton</a>( printIcon, "Print File", TQString::null, this, SLOT(print()), fileTools, "print file" ); @@ -159,7 +159,7 @@ private: "You can also select the <b>Open</b> command " "from the <b>File</b> menu.</p>"; -<a name="x1591"></a> TQWhatsThis::<a href="qwhatsthis.html#add">add</a>( fileOpen, fileOpenText ); +<a name="x1591"></a> TQWhatsThis::<a href="ntqwhatsthis.html#add">add</a>( fileOpen, fileOpenText ); <a name="x1558"></a> TQMimeSourceFactory::<a href="qmimesourcefactory.html#defaultFactory">defaultFactory</a>()->setPixmap( "fileopen", openIcon ); @@ -168,62 +168,62 @@ private: "You can also select the <b>Save</b> command " "from the <b>File</b> menu.</p>"; - TQWhatsThis::<a href="qwhatsthis.html#add">add</a>( fileSave, fileSaveText ); + TQWhatsThis::<a href="ntqwhatsthis.html#add">add</a>( 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."; - TQWhatsThis::<a href="qwhatsthis.html#add">add</a>( filePrint, filePrintText ); + TQWhatsThis::<a href="ntqwhatsthis.html#add">add</a>( filePrint, filePrintText ); - <a href="qpopupmenu.html">TQPopupMenu</a> * file = new <a href="qpopupmenu.html">TQPopupMenu</a>( this ); - <a href="qmainwindow.html#menuBar">menuBar</a>()->insertItem( "&File", file ); + <a href="ntqpopupmenu.html">TQPopupMenu</a> * file = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this ); + <a href="ntqmainwindow.html#menuBar">menuBar</a>()->insertItem( "&File", file ); - file-><a href="qmenudata.html#insertItem">insertItem</a>( "&New", this, SLOT(newDoc()), CTRL+Key_N ); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&New", this, SLOT(newDoc()), CTRL+Key_N ); int id; - id = file-><a href="qmenudata.html#insertItem">insertItem</a>( openIcon, "&Open...", + id = file-><a href="ntqmenudata.html#insertItem">insertItem</a>( openIcon, "&Open...", this, SLOT(choose()), CTRL+Key_O ); -<a name="x1554"></a> file-><a href="qmenudata.html#setWhatsThis">setWhatsThis</a>( id, fileOpenText ); +<a name="x1554"></a> file-><a href="ntqmenudata.html#setWhatsThis">setWhatsThis</a>( id, fileOpenText ); - id = file-><a href="qmenudata.html#insertItem">insertItem</a>( saveIcon, "&Save", + id = file-><a href="ntqmenudata.html#insertItem">insertItem</a>( saveIcon, "&Save", this, SLOT(save()), CTRL+Key_S ); - file-><a href="qmenudata.html#setWhatsThis">setWhatsThis</a>( id, fileSaveText ); + file-><a href="ntqmenudata.html#setWhatsThis">setWhatsThis</a>( id, fileSaveText ); - id = file-><a href="qmenudata.html#insertItem">insertItem</a>( "Save &As...", this, SLOT(saveAs()) ); - file-><a href="qmenudata.html#setWhatsThis">setWhatsThis</a>( id, fileSaveText ); + id = file-><a href="ntqmenudata.html#insertItem">insertItem</a>( "Save &As...", this, SLOT(saveAs()) ); + file-><a href="ntqmenudata.html#setWhatsThis">setWhatsThis</a>( id, fileSaveText ); - file-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); + file-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); - id = file-><a href="qmenudata.html#insertItem">insertItem</a>( printIcon, "&Print...", + id = file-><a href="ntqmenudata.html#insertItem">insertItem</a>( printIcon, "&Print...", this, SLOT(print()), CTRL+Key_P ); - file-><a href="qmenudata.html#setWhatsThis">setWhatsThis</a>( id, filePrintText ); + file-><a href="ntqmenudata.html#setWhatsThis">setWhatsThis</a>( id, filePrintText ); - file-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); + file-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); - file-><a href="qmenudata.html#insertItem">insertItem</a>( "&Close", this, SLOT(<a href="qwidget.html#close">close</a>()), CTRL+Key_W ); + file-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Close", this, SLOT(<a href="ntqwidget.html#close">close</a>()), CTRL+Key_W ); -<a name="x1544"></a> file-><a href="qmenudata.html#insertItem">insertItem</a>( "&Quit", qApp, SLOT( <a href="qapplication.html#closeAllWindows">closeAllWindows</a>() ), CTRL+Key_Q ); +<a name="x1544"></a> file-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&Quit", qApp, SLOT( <a href="ntqapplication.html#closeAllWindows">closeAllWindows</a>() ), CTRL+Key_Q ); - <a href="qmainwindow.html#menuBar">menuBar</a>()->insertSeparator(); + <a href="ntqmainwindow.html#menuBar">menuBar</a>()->insertSeparator(); - <a href="qpopupmenu.html">TQPopupMenu</a> * help = new <a href="qpopupmenu.html">TQPopupMenu</a>( this ); - <a href="qmainwindow.html#menuBar">menuBar</a>()->insertItem( "&Help", help ); + <a href="ntqpopupmenu.html">TQPopupMenu</a> * help = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this ); + <a href="ntqmainwindow.html#menuBar">menuBar</a>()->insertItem( "&Help", help ); - help-><a href="qmenudata.html#insertItem">insertItem</a>( "&About", this, SLOT(about()), Key_F1 ); - help-><a href="qmenudata.html#insertItem">insertItem</a>( "About &TQt", this, SLOT(aboutTQt()) ); - help-><a href="qmenudata.html#insertSeparator">insertSeparator</a>(); - help-><a href="qmenudata.html#insertItem">insertItem</a>( "What's &This", this, SLOT(<a href="qmainwindow.html#whatsThis">whatsThis</a>()), SHIFT+Key_F1 ); + help-><a href="ntqmenudata.html#insertItem">insertItem</a>( "&About", this, SLOT(about()), Key_F1 ); + help-><a href="ntqmenudata.html#insertItem">insertItem</a>( "About &TQt", this, SLOT(aboutTQt()) ); + help-><a href="ntqmenudata.html#insertSeparator">insertSeparator</a>(); + help-><a href="ntqmenudata.html#insertItem">insertItem</a>( "What's &This", this, SLOT(<a href="ntqmainwindow.html#whatsThis">whatsThis</a>()), SHIFT+Key_F1 ); - e = new <a href="qtextedit.html">TQTextEdit</a>( this, "editor" ); - e-><a href="qwidget.html#setFocus">setFocus</a>(); - <a href="qmainwindow.html#setCentralWidget">setCentralWidget</a>( e ); - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( "Ready", 2000 ); + e = new <a href="ntqtextedit.html">TQTextEdit</a>( this, "editor" ); + e-><a href="ntqwidget.html#setFocus">setFocus</a>(); + <a href="ntqmainwindow.html#setCentralWidget">setCentralWidget</a>( e ); + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( "Ready", 2000 ); - <a href="qwidget.html#resize">resize</a>( 450, 600 ); + <a href="ntqwidget.html#resize">resize</a>( 450, 600 ); } @@ -237,32 +237,32 @@ ApplicationWindow::~ApplicationWindow() void <a name="f460"></a>ApplicationWindow::newDoc() { ApplicationWindow *ed = new ApplicationWindow; - ed-><a href="qwidget.html#setCaption">setCaption</a>("TQt Example - Application"); - ed-><a href="qwidget.html#show">show</a>(); + ed-><a href="ntqwidget.html#setCaption">setCaption</a>("TQt Example - Application"); + ed-><a href="ntqwidget.html#show">show</a>(); } void <a name="f461"></a>ApplicationWindow::choose() { -<a name="x1549"></a> <a href="qstring.html">TQString</a> fn = TQFileDialog::<a href="qfiledialog.html#getOpenFileName">getOpenFileName</a>( TQString::null, TQString::null, +<a name="x1549"></a> <a href="ntqstring.html">TQString</a> fn = TQFileDialog::<a href="ntqfiledialog.html#getOpenFileName">getOpenFileName</a>( TQString::null, TQString::null, this); - if ( !fn.<a href="qstring.html#isEmpty">isEmpty</a>() ) + if ( !fn.<a href="ntqstring.html#isEmpty">isEmpty</a>() ) load( fn ); else - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( "Loading aborted", 2000 ); + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( "Loading aborted", 2000 ); } -void <a name="f462"></a>ApplicationWindow::load( const <a href="qstring.html">TQString</a> &fileName ) +void <a name="f462"></a>ApplicationWindow::load( const <a href="ntqstring.html">TQString</a> &fileName ) { - <a href="qfile.html">TQFile</a> f( fileName ); -<a name="x1548"></a> if ( !f.<a href="qfile.html#open">open</a>( <a href="qfile.html#open">IO_ReadOnly</a> ) ) + <a href="ntqfile.html">TQFile</a> f( fileName ); +<a name="x1548"></a> if ( !f.<a href="ntqfile.html#open">open</a>( <a href="ntqfile.html#open">IO_ReadOnly</a> ) ) return; - <a href="qtextstream.html">TQTextStream</a> ts( &f ); -<a name="x1589"></a><a name="x1586"></a> e-><a href="qtextedit.html#setText">setText</a>( ts.<a href="qtextstream.html#read">read</a>() ); -<a name="x1585"></a> e-><a href="qtextedit.html#setModified">setModified</a>( FALSE ); - <a href="qwidget.html#setCaption">setCaption</a>( fileName ); - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( "Loaded document " + fileName, 2000 ); + <a href="ntqtextstream.html">TQTextStream</a> ts( &f ); +<a name="x1589"></a><a name="x1586"></a> e-><a href="ntqtextedit.html#setText">setText</a>( ts.<a href="ntqtextstream.html#read">read</a>() ); +<a name="x1585"></a> e-><a href="ntqtextedit.html#setModified">setModified</a>( FALSE ); + <a href="ntqwidget.html#setCaption">setCaption</a>( fileName ); + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( "Loaded document " + fileName, 2000 ); } @@ -273,88 +273,88 @@ void <a name="f463"></a>ApplicationWindow::save() return; } -<a name="x1588"></a> <a href="qstring.html">TQString</a> text = e-><a href="qtextedit.html#text">text</a>(); - <a href="qfile.html">TQFile</a> f( filename ); - if ( !f.<a href="qfile.html#open">open</a>( <a href="qfile.html#open">IO_WriteOnly</a> ) ) { - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( TQString("Could not write to %1").arg(filename), +<a name="x1588"></a> <a href="ntqstring.html">TQString</a> text = e-><a href="ntqtextedit.html#text">text</a>(); + <a href="ntqfile.html">TQFile</a> f( filename ); + if ( !f.<a href="ntqfile.html#open">open</a>( <a href="ntqfile.html#open">IO_WriteOnly</a> ) ) { + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( TQString("Could not write to %1").arg(filename), 2000 ); return; } - <a href="qtextstream.html">TQTextStream</a> t( &f ); + <a href="ntqtextstream.html">TQTextStream</a> t( &f ); t << text; - f.<a href="qfile.html#close">close</a>(); + f.<a href="ntqfile.html#close">close</a>(); - e-><a href="qtextedit.html#setModified">setModified</a>( FALSE ); + e-><a href="ntqtextedit.html#setModified">setModified</a>( FALSE ); - <a href="qwidget.html#setCaption">setCaption</a>( filename ); + <a href="ntqwidget.html#setCaption">setCaption</a>( filename ); - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( TQString( "File %1 saved" ).arg( filename ), 2000 ); + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( TQString( "File %1 saved" ).arg( filename ), 2000 ); } void <a name="f464"></a>ApplicationWindow::saveAs() { -<a name="x1550"></a> <a href="qstring.html">TQString</a> fn = TQFileDialog::<a href="qfiledialog.html#getSaveFileName">getSaveFileName</a>( TQString::null, TQString::null, +<a name="x1550"></a> <a href="ntqstring.html">TQString</a> fn = TQFileDialog::<a href="ntqfiledialog.html#getSaveFileName">getSaveFileName</a>( TQString::null, TQString::null, this ); - if ( !fn.<a href="qstring.html#isEmpty">isEmpty</a>() ) { + if ( !fn.<a href="ntqstring.html#isEmpty">isEmpty</a>() ) { filename = fn; save(); } else { - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( "Saving aborted", 2000 ); + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( "Saving aborted", 2000 ); } } void <a name="f465"></a>ApplicationWindow::print() { -<a name="x1568"></a> printer-><a href="qprinter.html#setFullPage">setFullPage</a>( TRUE ); -<a name="x1569"></a> if ( printer-><a href="qprinter.html#setup">setup</a>(this) ) { // printer dialog - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( "Printing..." ); - <a href="qpainter.html">TQPainter</a> p; - if( !p.<a href="qpainter.html#begin">begin</a>( printer ) ) { // paint on printer - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( "Printing aborted", 2000 ); +<a name="x1568"></a> printer-><a href="ntqprinter.html#setFullPage">setFullPage</a>( TRUE ); +<a name="x1569"></a> if ( printer-><a href="ntqprinter.html#setup">setup</a>(this) ) { // printer dialog + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( "Printing..." ); + <a href="ntqpainter.html">TQPainter</a> p; + if( !p.<a href="ntqpainter.html#begin">begin</a>( printer ) ) { // paint on printer + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( "Printing aborted", 2000 ); return; } -<a name="x1563"></a> <a href="qpaintdevicemetrics.html">TQPaintDeviceMetrics</a> metrics( p.<a href="qpainter.html#device">device</a>() ); -<a name="x1560"></a> int dpiy = metrics.<a href="qpaintdevicemetrics.html#logicalDpiY">logicalDpiY</a>(); +<a name="x1563"></a> <a href="ntqpaintdevicemetrics.html">TQPaintDeviceMetrics</a> metrics( p.<a href="ntqpainter.html#device">device</a>() ); +<a name="x1560"></a> int dpiy = metrics.<a href="ntqpaintdevicemetrics.html#logicalDpiY">logicalDpiY</a>(); int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins -<a name="x1561"></a><a name="x1559"></a> <a href="qrect.html">TQRect</a> view( margin, margin, metrics.<a href="qpaintdevicemetrics.html#width">width</a>() - 2*margin, metrics.<a href="qpaintdevicemetrics.html#height">height</a>() - 2*margin ); -<a name="x1581"></a> <a href="qsimplerichtext.html">TQSimpleRichText</a> richText( TQStyleSheet::<a href="qstylesheet.html#convertFromPlainText">convertFromPlainText</a>(e-><a href="qtextedit.html#text">text</a>()), +<a name="x1561"></a><a name="x1559"></a> <a href="ntqrect.html">TQRect</a> view( margin, margin, metrics.<a href="ntqpaintdevicemetrics.html#width">width</a>() - 2*margin, metrics.<a href="ntqpaintdevicemetrics.html#height">height</a>() - 2*margin ); +<a name="x1581"></a> <a href="ntqsimplerichtext.html">TQSimpleRichText</a> richText( TQStyleSheet::<a href="ntqstylesheet.html#convertFromPlainText">convertFromPlainText</a>(e-><a href="ntqtextedit.html#text">text</a>()), TQFont(), -<a name="x1582"></a> e-><a href="qtextedit.html#context">context</a>(), -<a name="x1587"></a> e-><a href="qtextedit.html#styleSheet">styleSheet</a>(), -<a name="x1584"></a> e-><a href="qtextedit.html#mimeSourceFactory">mimeSourceFactory</a>(), - view.<a href="qrect.html#height">height</a>() ); -<a name="x1578"></a> richText.<a href="qsimplerichtext.html#setWidth">setWidth</a>( &p, view.<a href="qrect.html#width">width</a>() ); +<a name="x1582"></a> e-><a href="ntqtextedit.html#context">context</a>(), +<a name="x1587"></a> e-><a href="ntqtextedit.html#styleSheet">styleSheet</a>(), +<a name="x1584"></a> e-><a href="ntqtextedit.html#mimeSourceFactory">mimeSourceFactory</a>(), + view.<a href="ntqrect.html#height">height</a>() ); +<a name="x1578"></a> richText.<a href="ntqsimplerichtext.html#setWidth">setWidth</a>( &p, view.<a href="ntqrect.html#width">width</a>() ); int page = 1; do { -<a name="x1576"></a> richText.<a href="qsimplerichtext.html#draw">draw</a>( &p, margin, margin, view, colorGroup() ); -<a name="x1572"></a> view.<a href="qrect.html#moveBy">moveBy</a>( 0, view.<a href="qrect.html#height">height</a>() ); -<a name="x1566"></a> p.<a href="qpainter.html#translate">translate</a>( 0 , -view.<a href="qrect.html#height">height</a>() ); -<a name="x1580"></a><a name="x1573"></a><a name="x1565"></a> p.<a href="qpainter.html#drawText">drawText</a>( view.<a href="qrect.html#right">right</a>() - p.<a href="qpainter.html#fontMetrics">fontMetrics</a>().width( TQString::<a href="qstring.html#number">number</a>( page ) ), -<a name="x1570"></a> view.<a href="qrect.html#bottom">bottom</a>() + p.<a href="qpainter.html#fontMetrics">fontMetrics</a>().ascent() + 5, TQString::number( page ) ); -<a name="x1577"></a> if ( view.<a href="qrect.html#top">top</a>() - margin >= richText.<a href="qsimplerichtext.html#height">height</a>() ) +<a name="x1576"></a> richText.<a href="ntqsimplerichtext.html#draw">draw</a>( &p, margin, margin, view, colorGroup() ); +<a name="x1572"></a> view.<a href="ntqrect.html#moveBy">moveBy</a>( 0, view.<a href="ntqrect.html#height">height</a>() ); +<a name="x1566"></a> p.<a href="ntqpainter.html#translate">translate</a>( 0 , -view.<a href="ntqrect.html#height">height</a>() ); +<a name="x1580"></a><a name="x1573"></a><a name="x1565"></a> p.<a href="ntqpainter.html#drawText">drawText</a>( view.<a href="ntqrect.html#right">right</a>() - p.<a href="ntqpainter.html#fontMetrics">fontMetrics</a>().width( TQString::<a href="ntqstring.html#number">number</a>( page ) ), +<a name="x1570"></a> view.<a href="ntqrect.html#bottom">bottom</a>() + p.<a href="ntqpainter.html#fontMetrics">fontMetrics</a>().ascent() + 5, TQString::number( page ) ); +<a name="x1577"></a> if ( view.<a href="ntqrect.html#top">top</a>() - margin >= richText.<a href="ntqsimplerichtext.html#height">height</a>() ) break; -<a name="x1567"></a> printer-><a href="qprinter.html#newPage">newPage</a>(); +<a name="x1567"></a> printer-><a href="ntqprinter.html#newPage">newPage</a>(); page++; } while (TRUE); - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( "Printing completed", 2000 ); + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( "Printing completed", 2000 ); } else { - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( "Printing aborted", 2000 ); + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( "Printing aborted", 2000 ); } } -<a name="x1592"></a>void ApplicationWindow::<a href="qwidget.html#closeEvent">closeEvent</a>( <a href="qcloseevent.html">TQCloseEvent</a>* ce ) +<a name="x1592"></a>void ApplicationWindow::<a href="ntqwidget.html#closeEvent">closeEvent</a>( <a href="qcloseevent.html">TQCloseEvent</a>* ce ) { -<a name="x1583"></a> if ( !e-><a href="qtextedit.html#isModified">isModified</a>() ) { +<a name="x1583"></a> if ( !e-><a href="ntqtextedit.html#isModified">isModified</a>() ) { <a name="x1545"></a> ce-><a href="qcloseevent.html#accept">accept</a>(); return; } -<a name="x1557"></a> switch( TQMessageBox::<a href="qmessagebox.html#information">information</a>( this, "TQt Application Example", +<a name="x1557"></a> switch( TQMessageBox::<a href="ntqmessagebox.html#information">information</a>( this, "TQt Application Example", "Do you want to save the changes" " to the document?", "Yes", "No", "Cancel", @@ -376,7 +376,7 @@ void <a name="f465"></a>ApplicationWindow::print() void <a name="f466"></a>ApplicationWindow::about() { -<a name="x1555"></a> TQMessageBox::<a href="qmessagebox.html#about">about</a>( this, "TQt Application Example", +<a name="x1555"></a> TQMessageBox::<a href="ntqmessagebox.html#about">about</a>( this, "TQt Application Example", "This example demonstrates simple use of " "TQMainWindow,\nTQMenuBar and TQToolBar."); } @@ -384,7 +384,7 @@ void <a name="f466"></a>ApplicationWindow::about() void <a name="f467"></a>ApplicationWindow::aboutTQt() { -<a name="x1556"></a> TQMessageBox::<a href="qmessagebox.html#aboutTQt">aboutTQt</a>( this, "TQt Application Example" ); +<a name="x1556"></a> TQMessageBox::<a href="ntqmessagebox.html#aboutTQt">aboutTQt</a>( this, "TQt Application Example" ); } </pre> @@ -400,16 +400,16 @@ void <a name="f467"></a>ApplicationWindow::aboutTQt() ** *****************************************************************************/ -#include <<a href="qapplication-h.html">qapplication.h</a>> +#include <<a href="qapplication-h.html">ntqapplication.h</a>> #include "application.h" int main( int argc, char ** argv ) { - <a href="qapplication.html">TQApplication</a> a( argc, argv ); + <a href="ntqapplication.html">TQApplication</a> a( argc, argv ); ApplicationWindow *mw = new ApplicationWindow(); - mw-><a href="qwidget.html#setCaption">setCaption</a>( "TQt Example - Application" ); -<a name="x1598"></a> mw-><a href="qwidget.html#show">show</a>(); -<a name="x1599"></a> a.<a href="qobject.html#connect">connect</a>( &a, SIGNAL(<a href="qapplication.html#lastWindowClosed">lastWindowClosed</a>()), &a, SLOT(<a href="qapplication.html#quit">quit</a>()) ); - return a.<a href="qapplication.html#exec">exec</a>(); + mw-><a href="ntqwidget.html#setCaption">setCaption</a>( "TQt Example - Application" ); +<a name="x1598"></a> mw-><a href="ntqwidget.html#show">show</a>(); +<a name="x1599"></a> a.<a href="ntqobject.html#connect">connect</a>( &a, SIGNAL(<a href="ntqapplication.html#lastWindowClosed">lastWindowClosed</a>()), &a, SLOT(<a href="ntqapplication.html#quit">quit</a>()) ); + return a.<a href="ntqapplication.html#exec">exec</a>(); } </pre> |