diff options
author | Timothy Pearson <[email protected]> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/tutorial2-05.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/tutorial2-05.html')
-rw-r--r-- | doc/html/tutorial2-05.html | 194 |
1 files changed, 97 insertions, 97 deletions
diff --git a/doc/html/tutorial2-05.html b/doc/html/tutorial2-05.html index 23e6c76d9..22d1e7bee 100644 --- a/doc/html/tutorial2-05.html +++ b/doc/html/tutorial2-05.html @@ -40,7 +40,7 @@ conventional document-centric style. <p> (Extracts from <tt>chartform.h</tt>.) <p> -<pre> class ChartForm: public <a href="qmainwindow.html">TQMainWindow</a> +<pre> class ChartForm: public <a href="ntqmainwindow.html">TQMainWindow</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: @@ -49,14 +49,14 @@ conventional document-centric style. enum ChartType { PIE, VERTICAL_BAR, HORIZONTAL_BAR }; enum AddValuesType { NO, YES, AS_PERCENTAGE }; - ChartForm( const <a href="qstring.html">TQString</a>& filename ); + ChartForm( const <a href="ntqstring.html">TQString</a>& filename ); ~ChartForm(); int chartType() { return m_chartType; } void setChanged( bool changed = TRUE ) { m_changed = changed; } void drawElements(); - <a href="qpopupmenu.html">TQPopupMenu</a> *optionsMenu; // Why public? See canvasview.cpp + <a href="ntqpopupmenu.html">TQPopupMenu</a> *optionsMenu; // Why public? See canvasview.cpp protected: virtual void closeEvent( <a href="qcloseevent.html">TQCloseEvent</a> * ); @@ -71,7 +71,7 @@ conventional document-centric style. void filePrint(); void fileQuit(); void optionsSetData(); - void updateChartType( <a href="qaction.html">TQAction</a> *action ); + void updateChartType( <a href="ntqaction.html">TQAction</a> *action ); void optionsSetFont(); void optionsSetOptions(); void helpHelp(); @@ -81,35 +81,35 @@ conventional document-centric style. private: void init(); - void load( const <a href="qstring.html">TQString</a>& filename ); + void load( const <a href="ntqstring.html">TQString</a>& filename ); bool okToClear(); void drawPieChart( const double scales[], double total, int count ); void drawVerticalBarChart( const double scales[], double total, int count ); void drawHorizontalBarChart( const double scales[], double total, int count ); - <a href="qstring.html">TQString</a> valueLabel( const <a href="qstring.html">TQString</a>& label, double value, double total ); - void updateRecentFiles( const <a href="qstring.html">TQString</a>& filename ); + <a href="ntqstring.html">TQString</a> valueLabel( const <a href="ntqstring.html">TQString</a>& label, double value, double total ); + void updateRecentFiles( const <a href="ntqstring.html">TQString</a>& filename ); void updateRecentFilesMenu(); void setChartType( ChartType chartType ); - <a href="qpopupmenu.html">TQPopupMenu</a> *fileMenu; - <a href="qaction.html">TQAction</a> *optionsPieChartAction; - <a href="qaction.html">TQAction</a> *optionsHorizontalBarChartAction; - <a href="qaction.html">TQAction</a> *optionsVerticalBarChartAction; - <a href="qstring.html">TQString</a> m_filename; - <a href="qstringlist.html">TQStringList</a> m_recentFiles; - <a href="qcanvas.html">TQCanvas</a> *m_canvas; + <a href="ntqpopupmenu.html">TQPopupMenu</a> *fileMenu; + <a href="ntqaction.html">TQAction</a> *optionsPieChartAction; + <a href="ntqaction.html">TQAction</a> *optionsHorizontalBarChartAction; + <a href="ntqaction.html">TQAction</a> *optionsVerticalBarChartAction; + <a href="ntqstring.html">TQString</a> m_filename; + <a href="ntqstringlist.html">TQStringList</a> m_recentFiles; + <a href="ntqcanvas.html">TQCanvas</a> *m_canvas; CanvasView *m_canvasView; bool m_changed; ElementVector m_elements; - <a href="qprinter.html">TQPrinter</a> *m_printer; + <a href="ntqprinter.html">TQPrinter</a> *m_printer; ChartType m_chartType; AddValuesType m_addValues; int m_decimalPlaces; - <a href="qfont.html">TQFont</a> m_font; + <a href="ntqfont.html">TQFont</a> m_font; }; </pre> -<p> We create a <tt>ChartForm</tt> subclass of <a href="qmainwindow.html">TQMainWindow</a>. Our subclass uses +<p> We create a <tt>ChartForm</tt> subclass of <a href="ntqmainwindow.html">TQMainWindow</a>. Our subclass uses the <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro to support TQt's <a href="signalsandslots.html">signals and slots</a> mechanism. <p> The public interface is very small; the type of chart being displayed can be retrieved, the chart can be marked 'changed' (so that the user @@ -119,7 +119,7 @@ because we are also going to use this menu as the canvas view's context menu. <p> <center><table cellpadding="4" cellspacing="2" border="0"> <tr bgcolor="#f0f0f0"> -<td valign="top">The <a href="qcanvas.html">TQCanvas</a> class is used for drawing 2D vector graphics. The +<td valign="top">The <a href="ntqcanvas.html">TQCanvas</a> class is used for drawing 2D vector graphics. The <a href="qcanvasview.html">TQCanvasView</a> class is used to present a view of a canvas in an application's GUI. All our drawing operations take place on the canvas; but events (e.g. mouse clicks) take place on the canvas view. @@ -143,14 +143,14 @@ GUI, <tt>chartform_canvas.cpp</tt> for the canvas handling and <tt>chartform_fil which we've placed in the <tt>images</tt> subdirectory. <p> <h2> The Constructor </h2> -<a name="2"></a><p> <pre> ChartForm::ChartForm( const <a href="qstring.html">TQString</a>& filename ) - : <a href="qmainwindow.html">TQMainWindow</a>( 0, 0, WDestructiveClose ) +<a name="2"></a><p> <pre> ChartForm::ChartForm( const <a href="ntqstring.html">TQString</a>& filename ) + : <a href="ntqmainwindow.html">TQMainWindow</a>( 0, 0, WDestructiveClose ) </pre><tt>...</tt> -<pre> <a href="qaction.html">TQAction</a> *fileNewAction; - <a href="qaction.html">TQAction</a> *fileOpenAction; - <a href="qaction.html">TQAction</a> *fileSaveAction; +<pre> <a href="ntqaction.html">TQAction</a> *fileNewAction; + <a href="ntqaction.html">TQAction</a> *fileOpenAction; + <a href="ntqaction.html">TQAction</a> *fileSaveAction; </pre> -<p> For each user action we declare a <a href="qaction.html">TQAction</a> pointer. Some actions are +<p> For each user action we declare a <a href="ntqaction.html">TQAction</a> pointer. Some actions are declared in the header file because they need to be referred to outside of the constructor. <p> <center><table cellpadding="4" cellspacing="2" border="0"> @@ -160,10 +160,10 @@ buttons. TQt allows us to create a single TQAction which can be added to both a menu and a toolbar. This approach ensures that menu items and toolbar buttons stay in sync and saves duplicating code. </table></center> -<p> <pre> fileNewAction = new <a href="qaction.html">TQAction</a>( +<p> <pre> fileNewAction = new <a href="ntqaction.html">TQAction</a>( "New Chart", TQPixmap( file_new ), "&New", CTRL+Key_N, this, "new" ); - <a href="qobject.html#connect">connect</a>( fileNewAction, SIGNAL( <a href="qaction.html#activated">activated</a>() ), this, SLOT( fileNew() ) ); + <a href="ntqobject.html#connect">connect</a>( fileNewAction, SIGNAL( <a href="ntqaction.html#activated">activated</a>() ), this, SLOT( fileNew() ) ); </pre> <p> When we construct an action we give it a name, an optional icon, a menu text, and an accelerator short-cut key (or 0 if no accelerator is @@ -182,10 +182,10 @@ chart type actions in the group. </pre> <p> The action group becomes a child of the form (<tt>this</tt>) and the exlusive behaviour is achieved by the setExclusive() call. -<p> <pre> optionsPieChartAction = new <a href="qaction.html">TQAction</a>( +<p> <pre> optionsPieChartAction = new <a href="ntqaction.html">TQAction</a>( "Pie Chart", TQPixmap( options_piechart ), "&Pie Chart", CTRL+Key_I, chartGroup, "pie chart" ); - optionsPieChartAction-><a href="qaction.html#setToggleAction">setToggleAction</a>( TRUE ); + optionsPieChartAction-><a href="ntqaction.html#setToggleAction">setToggleAction</a>( TRUE ); </pre> <p> Each action in the group is created in the same way as other actions, except that the action's parent is the group rather than the form. @@ -205,44 +205,44 @@ canvas type we will connect the group. </table></center> <p> Once we've created all our user actions we can create the toolbars and menu options that will allow the user to invoke them. -<p> <pre> <a href="qtoolbar.html">TQToolBar</a>* fileTools = new <a href="qtoolbar.html">TQToolBar</a>( this, "file operations" ); - fileTools-><a href="qtoolbar.html#setLabel">setLabel</a>( "File Operations" ); - fileNewAction-><a href="qaction.html#addTo">addTo</a>( fileTools ); - fileOpenAction-><a href="qaction.html#addTo">addTo</a>( fileTools ); - fileSaveAction-><a href="qaction.html#addTo">addTo</a>( fileTools ); +<p> <pre> <a href="ntqtoolbar.html">TQToolBar</a>* fileTools = new <a href="ntqtoolbar.html">TQToolBar</a>( this, "file operations" ); + fileTools-><a href="ntqtoolbar.html#setLabel">setLabel</a>( "File Operations" ); + fileNewAction-><a href="ntqaction.html#addTo">addTo</a>( fileTools ); + fileOpenAction-><a href="ntqaction.html#addTo">addTo</a>( fileTools ); + fileSaveAction-><a href="ntqaction.html#addTo">addTo</a>( fileTools ); </pre><tt>...</tt> -<pre> fileMenu = new <a href="qpopupmenu.html">TQPopupMenu</a>( this ); - <a href="qmainwindow.html#menuBar">menuBar</a>()->insertItem( "&File", fileMenu ); - fileNewAction-><a href="qaction.html#addTo">addTo</a>( fileMenu ); - fileOpenAction-><a href="qaction.html#addTo">addTo</a>( fileMenu ); - fileSaveAction-><a href="qaction.html#addTo">addTo</a>( fileMenu ); +<pre> fileMenu = new <a href="ntqpopupmenu.html">TQPopupMenu</a>( this ); + <a href="ntqmainwindow.html#menuBar">menuBar</a>()->insertItem( "&File", fileMenu ); + fileNewAction-><a href="ntqaction.html#addTo">addTo</a>( fileMenu ); + fileOpenAction-><a href="ntqaction.html#addTo">addTo</a>( fileMenu ); + fileSaveAction-><a href="ntqaction.html#addTo">addTo</a>( fileMenu ); </pre> <p> Toolbar actions and menu options are easily created from TQActions. <p> As a convenience to our users we will restore the last window position and size and list their recently used files. This is achieved by writing out their settings when the application is closed and reading them back when we construct the form. -<p> <pre> <a href="qsettings.html">TQSettings</a> settings; - settings.<a href="qsettings.html#insertSearchPath">insertSearchPath</a>( TQSettings::Windows, WINDOWS_REGISTRY ); - int windowWidth = settings.<a href="qsettings.html#readNumEntry">readNumEntry</a>( APP_KEY + "WindowWidth", 460 ); - int windowHeight = settings.<a href="qsettings.html#readNumEntry">readNumEntry</a>( APP_KEY + "WindowHeight", 530 ); - int windowX = settings.<a href="qsettings.html#readNumEntry">readNumEntry</a>( APP_KEY + "WindowX", -1 ); - int windowY = settings.<a href="qsettings.html#readNumEntry">readNumEntry</a>( APP_KEY + "WindowY", -1 ); +<p> <pre> <a href="ntqsettings.html">TQSettings</a> settings; + settings.<a href="ntqsettings.html#insertSearchPath">insertSearchPath</a>( TQSettings::Windows, WINDOWS_REGISTRY ); + int windowWidth = settings.<a href="ntqsettings.html#readNumEntry">readNumEntry</a>( APP_KEY + "WindowWidth", 460 ); + int windowHeight = settings.<a href="ntqsettings.html#readNumEntry">readNumEntry</a>( APP_KEY + "WindowHeight", 530 ); + int windowX = settings.<a href="ntqsettings.html#readNumEntry">readNumEntry</a>( APP_KEY + "WindowX", -1 ); + int windowY = settings.<a href="ntqsettings.html#readNumEntry">readNumEntry</a>( APP_KEY + "WindowY", -1 ); setChartType( ChartType( - settings.<a href="qsettings.html#readNumEntry">readNumEntry</a>( APP_KEY + "ChartType", int(PIE) ) ) ); + settings.<a href="ntqsettings.html#readNumEntry">readNumEntry</a>( APP_KEY + "ChartType", int(PIE) ) ) ); </pre><pre> m_font = TQFont( "Helvetica", 18, TQFont::Bold ); m_font.fromString( - settings.<a href="qsettings.html#readEntry">readEntry</a>( APP_KEY + "Font", m_font.toString() ) ); + settings.<a href="ntqsettings.html#readEntry">readEntry</a>( APP_KEY + "Font", m_font.toString() ) ); for ( int i = 0; i < MAX_RECENTFILES; ++i ) { - <a href="qstring.html">TQString</a> filename = settings.<a href="qsettings.html#readEntry">readEntry</a>( APP_KEY + "File" + - TQString::<a href="qstring.html#number">number</a>( i + 1 ) ); - if ( !filename.<a href="qstring.html#isEmpty">isEmpty</a>() ) + <a href="ntqstring.html">TQString</a> filename = settings.<a href="ntqsettings.html#readEntry">readEntry</a>( APP_KEY + "File" + + TQString::<a href="ntqstring.html#number">number</a>( i + 1 ) ); + if ( !filename.<a href="ntqstring.html#isEmpty">isEmpty</a>() ) m_recentFiles.push_back( filename ); } if ( m_recentFiles.count() ) updateRecentFilesMenu(); </pre> -<p> The <a href="qsettings.html">TQSettings</a> class handles user settings in a platform-independent +<p> The <a href="ntqsettings.html">TQSettings</a> class handles user settings in a platform-independent way. We simply read and write settings, leaving TQSettings to handle the platform dependencies. The insertSearchPath() call does nothing except under Windows so does not have to be <tt>#ifdef</tt>ed. @@ -257,29 +257,29 @@ the settings. We attempt to read each possible file entry ("File1" to "File9"), and add each non-empty entry to the list of recently used files. If there are one or more recently used files we update the File menu by calling updateRecentFilesMenu(); (we'll review this later on). -<p> <pre> <a href="qobject.html#connect">connect</a>( chartGroup, SIGNAL( <a href="qactiongroup.html#selected">selected</a>(TQAction*) ), +<p> <pre> <a href="ntqobject.html#connect">connect</a>( chartGroup, SIGNAL( <a href="qactiongroup.html#selected">selected</a>(TQAction*) ), this, SLOT( updateChartType(TQAction*) ) ); </pre> <p> Now that we have set the chart type (when we read it in as a user setting) it is safe to connect the chart group to our updateChartType() slot. -<p> <pre> <a href="qwidget.html#resize">resize</a>( windowWidth, windowHeight ); +<p> <pre> <a href="ntqwidget.html#resize">resize</a>( windowWidth, windowHeight ); if ( windowX != -1 || windowY != -1 ) - <a href="qwidget.html#move">move</a>( windowX, windowY ); + <a href="ntqwidget.html#move">move</a>( windowX, windowY ); </pre> <p> And now that we know the window size and position we can resize and move the chart form's window accordingly. -<p> <pre> m_canvas = new <a href="qcanvas.html">TQCanvas</a>( this ); - m_canvas-><a href="qcanvas.html#resize">resize</a>( <a href="qwidget.html#width">width</a>(), height() ); +<p> <pre> m_canvas = new <a href="ntqcanvas.html">TQCanvas</a>( this ); + m_canvas-><a href="ntqcanvas.html#resize">resize</a>( <a href="ntqwidget.html#width">width</a>(), height() ); m_canvasView = new CanvasView( m_canvas, &m_elements, this ); - <a href="qmainwindow.html#setCentralWidget">setCentralWidget</a>( m_canvasView ); - m_canvasView-><a href="qwidget.html#show">show</a>(); + <a href="ntqmainwindow.html#setCentralWidget">setCentralWidget</a>( m_canvasView ); + m_canvasView-><a href="ntqwidget.html#show">show</a>(); </pre> -<p> We create a new <a href="qcanvas.html">TQCanvas</a> and set its size to that of the chart form +<p> We create a new <a href="ntqcanvas.html">TQCanvas</a> and set its size to that of the chart form window's client area. We also create a <tt>CanvasView</tt> (our own subclass of <a href="qcanvasview.html">TQCanvasView</a>) to display the TQCanvas. We make the canvas view the chart form's main widget and show it. -<p> <pre> if ( !filename.<a href="qstring.html#isEmpty">isEmpty</a>() ) +<p> <pre> if ( !filename.<a href="ntqstring.html#isEmpty">isEmpty</a>() ) load( filename ); else { init(); @@ -293,7 +293,7 @@ chart form's main widget and show it. </pre> <p> If we have a file to load we load it; otherwise we initialise our elements vector and draw a sample chart. -<p> <pre> <a href="qmainwindow.html#statusBar">statusBar</a>()->message( "Ready", 2000 ); +<p> <pre> <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( "Ready", 2000 ); </pre> <p> It is <em>vital</em> that we call statusBar() in the constructor, since the call ensures that a status bar is created for this main window. @@ -301,8 +301,8 @@ call ensures that a status bar is created for this main window. </h3> <a name="2-1"></a><p> <pre> void ChartForm::init() { - <a href="qwidget.html#setCaption">setCaption</a>( "Chart" ); - m_filename = <a href="qstring.html#TQString-null">TQString::null</a>; + <a href="ntqwidget.html#setCaption">setCaption</a>( "Chart" ); + m_filename = <a href="ntqstring.html#TQString-null">TQString::null</a>; m_changed = FALSE; m_elements[0] = Element( Element::INVALID, red ); @@ -325,14 +325,14 @@ already have a unique color (which they can change of course). <a name="3-1"></a><p> <pre> bool ChartForm::okToClear() { if ( m_changed ) { - <a href="qstring.html">TQString</a> msg; + <a href="ntqstring.html">TQString</a> msg; if ( m_filename.isEmpty() ) msg = "Unnamed chart "; else msg = TQString( "Chart '%1'\n" ).arg( m_filename ); msg += "has been changed."; - int x = TQMessageBox::<a href="qmessagebox.html#information">information</a>( this, "Chart -- Unsaved Changes", + int x = TQMessageBox::<a href="ntqmessagebox.html#information">information</a>( this, "Chart -- Unsaved Changes", msg, "&Save", "Cancel", "&Abandon", 0, 1 ); switch( x ) { @@ -383,29 +383,29 @@ added a call to optionsSetData() and see which you prefer. if ( !okToClear() ) return; - <a href="qstring.html">TQString</a> filename = TQFileDialog::<a href="qfiledialog.html#getOpenFileName">getOpenFileName</a>( + <a href="ntqstring.html">TQString</a> filename = TQFileDialog::<a href="ntqfiledialog.html#getOpenFileName">getOpenFileName</a>( TQString::null, "Charts (*.cht)", this, "file open", "Chart -- File Open" ); - <a name="x2567"></a> if ( !filename.<a href="qstring.html#isEmpty">isEmpty</a>() ) + <a name="x2567"></a> if ( !filename.<a href="ntqstring.html#isEmpty">isEmpty</a>() ) load( filename ); else - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( "File Open abandoned", 2000 ); + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( "File Open abandoned", 2000 ); } </pre> <p> We check that it is okToClear(). If it is we use the static -<a href="qfiledialog.html#getOpenFileName">TQFileDialog::getOpenFileName</a>() function to get the name of the file +<a href="ntqfiledialog.html#getOpenFileName">TQFileDialog::getOpenFileName</a>() function to get the name of the file the user wishes to load. If we get a filename we call load(). <p> <h3> fileSaveAs() </h3> <a name="3-4"></a><p> <pre> void ChartForm::fileSaveAs() { - <a href="qstring.html">TQString</a> filename = TQFileDialog::<a href="qfiledialog.html#getSaveFileName">getSaveFileName</a>( + <a href="ntqstring.html">TQString</a> filename = TQFileDialog::<a href="ntqfiledialog.html#getSaveFileName">getSaveFileName</a>( TQString::null, "Charts (*.cht)", this, "file save as", "Chart -- File Save As" ); - if ( !filename.<a href="qstring.html#isEmpty">isEmpty</a>() ) { + if ( !filename.<a href="ntqstring.html#isEmpty">isEmpty</a>() ) { int answer = 0; - <a name="x2563"></a> if ( TQFile::<a href="qfile.html#exists">exists</a>( filename ) ) - <a name="x2566"></a> answer = TQMessageBox::<a href="qmessagebox.html#warning">warning</a>( + <a name="x2563"></a> if ( TQFile::<a href="ntqfile.html#exists">exists</a>( filename ) ) + <a name="x2566"></a> answer = TQMessageBox::<a href="ntqmessagebox.html#warning">warning</a>( this, "Chart -- Overwrite File", TQString( "Overwrite\n\'%1\'?" ). arg( filename ), @@ -417,19 +417,19 @@ the user wishes to load. If we get a filename we call load(). return; } } - <a href="qmainwindow.html#statusBar">statusBar</a>()->message( "Saving abandoned", 2000 ); + <a href="ntqmainwindow.html#statusBar">statusBar</a>()->message( "Saving abandoned", 2000 ); } </pre> -<p> This function calls the static <a href="qfiledialog.html#getSaveFileName">TQFileDialog::getSaveFileName</a>() to get +<p> This function calls the static <a href="ntqfiledialog.html#getSaveFileName">TQFileDialog::getSaveFileName</a>() to get the name of the file to save the data in. If the file exists we use a -<a href="qmessagebox.html#warning">TQMessageBox::warning</a>() to notify the user and give them the option of +<a href="ntqmessagebox.html#warning">TQMessageBox::warning</a>() to notify the user and give them the option of abandoning the save. If the file is to be saved we update the recently opened files list and call fileSave() (covered in <a href="tutorial2-07.html">File Handling</a>) to perform the save. <p> <h2> Managing a list of Recently Opened Files </h2> <a name="4"></a><p> -<pre> <a href="qstringlist.html">TQStringList</a> m_recentFiles; +<pre> <a href="ntqstringlist.html">TQStringList</a> m_recentFiles; </pre> <p> We hold the list of recently opened files in a string list. <p> @@ -437,10 +437,10 @@ opened files list and call fileSave() (covered in <a href="tutorial2-07.html">Fi <pre> void ChartForm::updateRecentFilesMenu() { for ( int i = 0; i < MAX_RECENTFILES; ++i ) { - if ( fileMenu-><a href="qmenudata.html#findItem">findItem</a>( i ) ) - fileMenu-><a href="qmenudata.html#removeItem">removeItem</a>( i ); + if ( fileMenu-><a href="ntqmenudata.html#findItem">findItem</a>( i ) ) + fileMenu-><a href="ntqmenudata.html#removeItem">removeItem</a>( i ); if ( i < int(m_recentFiles.count()) ) - fileMenu-><a href="qmenudata.html#insertItem">insertItem</a>( TQString( "&%1 %2" ). + fileMenu-><a href="ntqmenudata.html#insertItem">insertItem</a>( TQString( "&%1 %2" ). arg( i + 1 ).arg( m_recentFiles[i] ), this, SLOT( fileOpenRecent(int) ), 0, i ); @@ -460,7 +460,7 @@ other file menu items had ids created by TQt (all of which are < 0); whereas the menu items we're creating all have ids >= 0. <p> -<pre> void ChartForm::updateRecentFiles( const <a href="qstring.html">TQString</a>& filename ) +<pre> void ChartForm::updateRecentFiles( const <a href="ntqstring.html">TQString</a>& filename ) { if ( m_recentFiles.find( filename ) != m_recentFiles.end() ) return; @@ -499,7 +499,7 @@ item id. { if ( okToClear() ) { saveOptions(); - qApp-><a href="qapplication.html#exit">exit</a>( 0 ); + qApp-><a href="ntqapplication.html#exit">exit</a>( 0 ); } } </pre> @@ -508,22 +508,22 @@ data (okToClear()) then save their options, e.g. window size and position, chart type, etc., before terminating. <p> <pre> void ChartForm::saveOptions() { - <a href="qsettings.html">TQSettings</a> settings; - settings.<a href="qsettings.html#insertSearchPath">insertSearchPath</a>( TQSettings::Windows, WINDOWS_REGISTRY ); - settings.<a href="qsettings.html#writeEntry">writeEntry</a>( APP_KEY + "WindowWidth", width() ); - settings.<a href="qsettings.html#writeEntry">writeEntry</a>( APP_KEY + "WindowHeight", height() ); - settings.<a href="qsettings.html#writeEntry">writeEntry</a>( APP_KEY + "WindowX", x() ); - settings.<a href="qsettings.html#writeEntry">writeEntry</a>( APP_KEY + "WindowY", y() ); - settings.<a href="qsettings.html#writeEntry">writeEntry</a>( APP_KEY + "ChartType", int(m_chartType) ); - settings.<a href="qsettings.html#writeEntry">writeEntry</a>( APP_KEY + "AddValues", int(m_addValues) ); - settings.<a href="qsettings.html#writeEntry">writeEntry</a>( APP_KEY + "Decimals", m_decimalPlaces ); - settings.<a href="qsettings.html#writeEntry">writeEntry</a>( APP_KEY + "Font", m_font.toString() ); + <a href="ntqsettings.html">TQSettings</a> settings; + settings.<a href="ntqsettings.html#insertSearchPath">insertSearchPath</a>( TQSettings::Windows, WINDOWS_REGISTRY ); + settings.<a href="ntqsettings.html#writeEntry">writeEntry</a>( APP_KEY + "WindowWidth", width() ); + settings.<a href="ntqsettings.html#writeEntry">writeEntry</a>( APP_KEY + "WindowHeight", height() ); + settings.<a href="ntqsettings.html#writeEntry">writeEntry</a>( APP_KEY + "WindowX", x() ); + settings.<a href="ntqsettings.html#writeEntry">writeEntry</a>( APP_KEY + "WindowY", y() ); + settings.<a href="ntqsettings.html#writeEntry">writeEntry</a>( APP_KEY + "ChartType", int(m_chartType) ); + settings.<a href="ntqsettings.html#writeEntry">writeEntry</a>( APP_KEY + "AddValues", int(m_addValues) ); + settings.<a href="ntqsettings.html#writeEntry">writeEntry</a>( APP_KEY + "Decimals", m_decimalPlaces ); + settings.<a href="ntqsettings.html#writeEntry">writeEntry</a>( APP_KEY + "Font", m_font.toString() ); for ( int i = 0; i < int(m_recentFiles.count()); ++i ) - settings.<a href="qsettings.html#writeEntry">writeEntry</a>( APP_KEY + "File" + TQString::number( i + 1 ), + settings.<a href="ntqsettings.html#writeEntry">writeEntry</a>( APP_KEY + "File" + TQString::number( i + 1 ), m_recentFiles[i] ); } </pre> -<p> Saving the user's options using <a href="qsettings.html">TQSettings</a> is straight-forward. +<p> Saving the user's options using <a href="ntqsettings.html">TQSettings</a> is straight-forward. <p> <h2> Custom Dialogs </h2> <a name="6"></a><p> We want the user to be able to set some options manually and to create @@ -534,11 +534,11 @@ and edit values, value colors, etc. { OptionsForm *optionsForm = new OptionsForm( this ); optionsForm->chartTypeComboBox->setCurrentItem( m_chartType ); - optionsForm-><a href="qwidget.html#setFont">setFont</a>( m_font ); -</pre><pre> if ( optionsForm-><a href="qdialog.html#exec">exec</a>() ) { + optionsForm-><a href="ntqwidget.html#setFont">setFont</a>( m_font ); +</pre><pre> if ( optionsForm-><a href="ntqdialog.html#exec">exec</a>() ) { setChartType( ChartType( optionsForm->chartTypeComboBox->currentItem()) ); - m_font = optionsForm-><a href="qwidget.html#font">font</a>(); + m_font = optionsForm-><a href="ntqwidget.html#font">font</a>(); </pre><pre> drawElements(); } delete optionsForm; @@ -555,7 +555,7 @@ elements. <pre> void ChartForm::optionsSetData() { SetDataForm *setDataForm = new SetDataForm( &m_elements, m_decimalPlaces, this ); - if ( setDataForm-><a href="qdialog.html#exec">exec</a>() ) { + if ( setDataForm-><a href="ntqdialog.html#exec">exec</a>() ) { m_changed = TRUE; drawElements(); } |