From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/canvas-chart-example.html | 450 ++++++++++++++++++------------------- 1 file changed, 225 insertions(+), 225 deletions(-) (limited to 'doc/html/canvas-chart-example.html') diff --git a/doc/html/canvas-chart-example.html b/doc/html/canvas-chart-example.html index bcf4ae444..f17307533 100644 --- a/doc/html/canvas-chart-example.html +++ b/doc/html/canvas-chart-example.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; }

This is a complete example program with a main window, menus and -toolbars. The main widget is a TQCanvas, and this example +toolbars. The main widget is a TQCanvas, and this example demonstrates basic canvas usage.


@@ -67,10 +67,10 @@ SOURCES += element.cpp \

#ifndef ELEMENT_H
 #define ELEMENT_H
 
-#include <qcolor.h>
-#include <qnamespace.h>
-#include <qstring.h>
-#include <qvaluevector.h>
+#include <ntqcolor.h>
+#include <ntqnamespace.h>
+#include <ntqstring.h>
+#include <ntqvaluevector.h>
 
 class Element;
 
@@ -91,8 +91,8 @@ public:
 
     Element( double value = INVALID, TQColor valueColor = TQt::gray,
              int valuePattern = TQt::SolidPattern,
-             const TQString& label = TQString::null,
-             TQColor labelColor = TQt::black ) {
+             const TQString& label = TQString::null,
+             TQColor labelColor = TQt::black ) {
         init( value, valueColor, valuePattern, label, labelColor );
         for ( int i = 0; i < MAX_PROPOINTS * 2; ++i )
             m_propoints[i] = NO_PROPORTION;
@@ -102,24 +102,24 @@ public:
     bool isValid() const { return m_value > EPSILON; }
 
     double value() const { return m_value; }
-    TQColor valueColor() const { return m_valueColor; }
+    TQColor valueColor() const { return m_valueColor; }
     int valuePattern() const { return m_valuePattern; }
-    TQString label() const { return m_label; }
-    TQColor labelColor() const { return m_labelColor; }
+    TQString label() const { return m_label; }
+    TQColor labelColor() const { return m_labelColor; }
     double proX( int index ) const;
     double proY( int index ) const;
 
     void set( double value = INVALID, TQColor valueColor = TQt::gray,
               int valuePattern = TQt::SolidPattern,
-              const TQString& label = TQString::null,
-              TQColor labelColor = TQt::black ) {
+              const TQString& label = TQString::null,
+              TQColor labelColor = TQt::black ) {
         init( value, valueColor, valuePattern, label, labelColor );
     }
     void setValue( double value ) { m_value = value; }
-    void setValueColor( TQColor valueColor ) { m_valueColor = valueColor; }
+    void setValueColor( TQColor valueColor ) { m_valueColor = valueColor; }
     void setValuePattern( int valuePattern );
-    void setLabel( const TQString& label ) { m_label = label; }
-    void setLabelColor( TQColor labelColor ) { m_labelColor = labelColor; }
+    void setLabel( const TQString& label ) { m_label = label; }
+    void setLabelColor( TQColor labelColor ) { m_labelColor = labelColor; }
     void setProX( int index, double value );
     void setProY( int index, double value );
 
@@ -133,19 +133,19 @@ public:
 
 private:
     void init( double value, TQColor valueColor, int valuePattern,
-               const TQString& label, TQColor labelColor );
+               const TQString& label, TQColor labelColor );
 
     double m_value;
-    TQColor m_valueColor;
+    TQColor m_valueColor;
     int m_valuePattern;
-    TQString m_label;
-    TQColor m_labelColor;
+    TQString m_label;
+    TQColor m_labelColor;
     double m_propoints[2 * MAX_PROPOINTS];
 };
 
 
-TQTextStream &operator<<( TQTextStream&, const Element& );
-TQTextStream &operator>>( TQTextStream&, Element& );
+TQTextStream &operator<<( TQTextStream&, const Element& );
+TQTextStream &operator>>( TQTextStream&, Element& );
 
 #endif
 
@@ -155,8 +155,8 @@ TQTextStream &operator>>( TQTextStream& #include "element.h" -#include <qmainwindow.h> -#include <qstringlist.h> +#include <ntqmainwindow.h> +#include <ntqstringlist.h> class CanvasView; @@ -168,7 +168,7 @@ class TQPrinter; class TQString; -class ChartForm: public TQMainWindow +class ChartForm: public TQMainWindow { Q_OBJECT public: @@ -177,14 +177,14 @@ public: enum ChartType { PIE, VERTICAL_BAR, HORIZONTAL_BAR }; enum AddValuesType { NO, YES, AS_PERCENTAGE }; - ChartForm( const TQString& filename ); + ChartForm( const TQString& filename ); ~ChartForm(); int chartType() { return m_chartType; } void setChanged( bool changed = TRUE ) { m_changed = changed; } void drawElements(); - TQPopupMenu *optionsMenu; // Why public? See canvasview.cpp + TQPopupMenu *optionsMenu; // Why public? See canvasview.cpp protected: virtual void closeEvent( TQCloseEvent * ); @@ -199,7 +199,7 @@ private slots: void filePrint(); void fileQuit(); void optionsSetData(); - void updateChartType( TQAction *action ); + void updateChartType( TQAction *action ); void optionsSetFont(); void optionsSetOptions(); void helpHelp(); @@ -209,34 +209,34 @@ private slots: private: void init(); - void load( const TQString& filename ); + void load( const TQString& 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 ); - TQString valueLabel( const TQString& label, double value, double total ); - void updateRecentFiles( const TQString& filename ); + TQString valueLabel( const TQString& label, double value, double total ); + void updateRecentFiles( const TQString& filename ); void updateRecentFilesMenu(); void setChartType( ChartType chartType ); - TQPopupMenu *fileMenu; - TQAction *optionsPieChartAction; - TQAction *optionsHorizontalBarChartAction; - TQAction *optionsVerticalBarChartAction; + TQPopupMenu *fileMenu; + TQAction *optionsPieChartAction; + TQAction *optionsHorizontalBarChartAction; + TQAction *optionsVerticalBarChartAction; - TQString m_filename; - TQStringList m_recentFiles; - TQCanvas *m_canvas; + TQString m_filename; + TQStringList m_recentFiles; + TQCanvas *m_canvas; CanvasView *m_canvasView; bool m_changed; ElementVector m_elements; - TQPrinter *m_printer; + TQPrinter *m_printer; ChartType m_chartType; AddValuesType m_addValues; int m_decimalPlaces; - TQFont m_font; + TQFont m_font; }; #endif @@ -249,24 +249,24 @@ private: #include "optionsform.h" #include "setdataform.h" -#include <qaction.h> -#include <qapplication.h> -#include <qcombobox.h> -#include <qfile.h> -#include <qfiledialog.h> -#include <qfont.h> -#include <qfontdialog.h> -#include <qmenubar.h> -#include <qmessagebox.h> -#include <qpixmap.h> -#include <qpopupmenu.h> -#include <qprinter.h> -#include <qradiobutton.h> -#include <qsettings.h> -#include <qspinbox.h> -#include <qstatusbar.h> -#include <qtoolbar.h> -#include <qtoolbutton.h> +#include <ntqaction.h> +#include <ntqapplication.h> +#include <ntqcombobox.h> +#include <ntqfile.h> +#include <ntqfiledialog.h> +#include <ntqfont.h> +#include <ntqfontdialog.h> +#include <ntqmenubar.h> +#include <ntqmessagebox.h> +#include <ntqpixmap.h> +#include <ntqpopupmenu.h> +#include <ntqprinter.h> +#include <ntqradiobutton.h> +#include <ntqsettings.h> +#include <ntqspinbox.h> +#include <ntqstatusbar.h> +#include <ntqtoolbar.h> +#include <ntqtoolbutton.h> #include "images/file_new.xpm" #include "images/file_open.xpm" @@ -280,177 +280,177 @@ private: #include "images/options_verticalbarchart.xpm" -const TQString WINDOWS_REGISTRY = "/Trolltech/TQtExamples"; -const TQString APP_KEY = "/Chart/"; +const TQString WINDOWS_REGISTRY = "/Trolltech/TQtExamples"; +const TQString APP_KEY = "/Chart/"; -ChartForm::ChartForm( const TQString& filename ) - : TQMainWindow( 0, 0, WDestructiveClose ) +ChartForm::ChartForm( const TQString& filename ) + : TQMainWindow( 0, 0, WDestructiveClose ) { - setIcon( TQPixmap( options_piechart ) ); - - TQAction *fileNewAction; - TQAction *fileOpenAction; - TQAction *fileSaveAction; - TQAction *fileSaveAsAction; - TQAction *fileSaveAsPixmapAction; - TQAction *filePrintAction; - TQAction *fileQuitAction; - TQAction *optionsSetDataAction; - TQAction *optionsSetFontAction; - TQAction *optionsSetOptionsAction; - - fileNewAction = new TQAction( + setIcon( TQPixmap( options_piechart ) ); + + TQAction *fileNewAction; + TQAction *fileOpenAction; + TQAction *fileSaveAction; + TQAction *fileSaveAsAction; + TQAction *fileSaveAsPixmapAction; + TQAction *filePrintAction; + TQAction *fileQuitAction; + TQAction *optionsSetDataAction; + TQAction *optionsSetFontAction; + TQAction *optionsSetOptionsAction; + + fileNewAction = new TQAction( "New Chart", TQPixmap( file_new ), "&New", CTRL+Key_N, this, "new" ); - connect( fileNewAction, SIGNAL( activated() ), this, SLOT( fileNew() ) ); + connect( fileNewAction, SIGNAL( activated() ), this, SLOT( fileNew() ) ); - fileOpenAction = new TQAction( + fileOpenAction = new TQAction( "Open Chart", TQPixmap( file_open ), "&Open...", CTRL+Key_O, this, "open" ); - connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); + connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) ); - fileSaveAction = new TQAction( + fileSaveAction = new TQAction( "Save Chart", TQPixmap( file_save ), "&Save", CTRL+Key_S, this, "save" ); - connect( fileSaveAction, SIGNAL( activated() ), this, SLOT( fileSave() ) ); + connect( fileSaveAction, SIGNAL( activated() ), this, SLOT( fileSave() ) ); - fileSaveAsAction = new TQAction( + fileSaveAsAction = new TQAction( "Save Chart As", TQPixmap( file_save ), "Save &As...", 0, this, "save as" ); - connect( fileSaveAsAction, SIGNAL( activated() ), + connect( fileSaveAsAction, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) ); - fileSaveAsPixmapAction = new TQAction( + fileSaveAsPixmapAction = new TQAction( "Save Chart As Bitmap", TQPixmap( file_save ), "Save As &Bitmap...", CTRL+Key_B, this, "save as bitmap" ); - connect( fileSaveAsPixmapAction, SIGNAL( activated() ), + connect( fileSaveAsPixmapAction, SIGNAL( activated() ), this, SLOT( fileSaveAsPixmap() ) ); - filePrintAction = new TQAction( + filePrintAction = new TQAction( "Print Chart", TQPixmap( file_print ), "&Print Chart...", CTRL+Key_P, this, "print chart" ); - connect( filePrintAction, SIGNAL( activated() ), + connect( filePrintAction, SIGNAL( activated() ), this, SLOT( filePrint() ) ); - optionsSetDataAction = new TQAction( + optionsSetDataAction = new TQAction( "Set Data", TQPixmap( options_setdata ), "Set &Data...", CTRL+Key_D, this, "set data" ); - connect( optionsSetDataAction, SIGNAL( activated() ), + connect( optionsSetDataAction, SIGNAL( activated() ), this, SLOT( optionsSetData() ) ); TQActionGroup *chartGroup = new TQActionGroup( this ); // Connected later chartGroup->setExclusive( TRUE ); - optionsPieChartAction = new TQAction( + optionsPieChartAction = new TQAction( "Pie Chart", TQPixmap( options_piechart ), "&Pie Chart", CTRL+Key_I, chartGroup, "pie chart" ); - optionsPieChartAction->setToggleAction( TRUE ); + optionsPieChartAction->setToggleAction( TRUE ); - optionsHorizontalBarChartAction = new TQAction( + optionsHorizontalBarChartAction = new TQAction( "Horizontal Bar Chart", TQPixmap( options_horizontalbarchart ), "&Horizontal Bar Chart", CTRL+Key_H, chartGroup, "horizontal bar chart" ); - optionsHorizontalBarChartAction->setToggleAction( TRUE ); + optionsHorizontalBarChartAction->setToggleAction( TRUE ); - optionsVerticalBarChartAction = new TQAction( + optionsVerticalBarChartAction = new TQAction( "Vertical Bar Chart", TQPixmap( options_verticalbarchart ), "&Vertical Bar Chart", CTRL+Key_V, chartGroup, "Vertical bar chart" ); - optionsVerticalBarChartAction->setToggleAction( TRUE ); + optionsVerticalBarChartAction->setToggleAction( TRUE ); - optionsSetFontAction = new TQAction( + optionsSetFontAction = new TQAction( "Set Font", TQPixmap( options_setfont ), "Set &Font...", CTRL+Key_F, this, "set font" ); - connect( optionsSetFontAction, SIGNAL( activated() ), + connect( optionsSetFontAction, SIGNAL( activated() ), this, SLOT( optionsSetFont() ) ); - optionsSetOptionsAction = new TQAction( + optionsSetOptionsAction = new TQAction( "Set Options", TQPixmap( options_setoptions ), "Set &Options...", 0, this, "set options" ); - connect( optionsSetOptionsAction, SIGNAL( activated() ), + connect( optionsSetOptionsAction, SIGNAL( activated() ), this, SLOT( optionsSetOptions() ) ); - fileQuitAction = new TQAction( "Quit", "&Quit", CTRL+Key_Q, this, "quit" ); - connect( fileQuitAction, SIGNAL( activated() ), this, SLOT( fileQuit() ) ); - - - TQToolBar* fileTools = new TQToolBar( this, "file operations" ); - fileTools->setLabel( "File Operations" ); - fileNewAction->addTo( fileTools ); - fileOpenAction->addTo( fileTools ); - fileSaveAction->addTo( fileTools ); - fileTools->addSeparator(); - filePrintAction->addTo( fileTools ); - - TQToolBar *optionsTools = new TQToolBar( this, "options operations" ); - optionsTools->setLabel( "Options Operations" ); - optionsSetDataAction->addTo( optionsTools ); - optionsTools->addSeparator(); - optionsPieChartAction->addTo( optionsTools ); - optionsHorizontalBarChartAction->addTo( optionsTools ); - optionsVerticalBarChartAction->addTo( optionsTools ); - optionsTools->addSeparator(); - optionsSetFontAction->addTo( optionsTools ); - optionsTools->addSeparator(); - optionsSetOptionsAction->addTo( optionsTools ); - - fileMenu = new TQPopupMenu( this ); - menuBar()->insertItem( "&File", fileMenu ); - fileNewAction->addTo( fileMenu ); - fileOpenAction->addTo( fileMenu ); - fileSaveAction->addTo( fileMenu ); - fileSaveAsAction->addTo( fileMenu ); - fileMenu->insertSeparator(); - fileSaveAsPixmapAction->addTo( fileMenu ); - fileMenu->insertSeparator(); - filePrintAction->addTo( fileMenu ); - fileMenu->insertSeparator(); - fileQuitAction->addTo( fileMenu ); - - optionsMenu = new TQPopupMenu( this ); - menuBar()->insertItem( "&Options", optionsMenu ); - optionsSetDataAction->addTo( optionsMenu ); - optionsMenu->insertSeparator(); - optionsPieChartAction->addTo( optionsMenu ); - optionsHorizontalBarChartAction->addTo( optionsMenu ); - optionsVerticalBarChartAction->addTo( optionsMenu ); - optionsMenu->insertSeparator(); - optionsSetFontAction->addTo( optionsMenu ); - optionsMenu->insertSeparator(); - optionsSetOptionsAction->addTo( optionsMenu ); - - menuBar()->insertSeparator(); - - TQPopupMenu *helpMenu = new TQPopupMenu( this ); - menuBar()->insertItem( "&Help", helpMenu ); - helpMenu->insertItem( "&Help", this, SLOT(helpHelp()), Key_F1 ); - helpMenu->insertItem( "&About", this, SLOT(helpAbout()) ); - helpMenu->insertItem( "About &TQt", this, SLOT(helpAboutTQt()) ); + fileQuitAction = new TQAction( "Quit", "&Quit", CTRL+Key_Q, this, "quit" ); + connect( fileQuitAction, SIGNAL( activated() ), this, SLOT( fileQuit() ) ); + + + TQToolBar* fileTools = new TQToolBar( this, "file operations" ); + fileTools->setLabel( "File Operations" ); + fileNewAction->addTo( fileTools ); + fileOpenAction->addTo( fileTools ); + fileSaveAction->addTo( fileTools ); + fileTools->addSeparator(); + filePrintAction->addTo( fileTools ); + + TQToolBar *optionsTools = new TQToolBar( this, "options operations" ); + optionsTools->setLabel( "Options Operations" ); + optionsSetDataAction->addTo( optionsTools ); + optionsTools->addSeparator(); + optionsPieChartAction->addTo( optionsTools ); + optionsHorizontalBarChartAction->addTo( optionsTools ); + optionsVerticalBarChartAction->addTo( optionsTools ); + optionsTools->addSeparator(); + optionsSetFontAction->addTo( optionsTools ); + optionsTools->addSeparator(); + optionsSetOptionsAction->addTo( optionsTools ); + + fileMenu = new TQPopupMenu( this ); + menuBar()->insertItem( "&File", fileMenu ); + fileNewAction->addTo( fileMenu ); + fileOpenAction->addTo( fileMenu ); + fileSaveAction->addTo( fileMenu ); + fileSaveAsAction->addTo( fileMenu ); + fileMenu->insertSeparator(); + fileSaveAsPixmapAction->addTo( fileMenu ); + fileMenu->insertSeparator(); + filePrintAction->addTo( fileMenu ); + fileMenu->insertSeparator(); + fileQuitAction->addTo( fileMenu ); + + optionsMenu = new TQPopupMenu( this ); + menuBar()->insertItem( "&Options", optionsMenu ); + optionsSetDataAction->addTo( optionsMenu ); + optionsMenu->insertSeparator(); + optionsPieChartAction->addTo( optionsMenu ); + optionsHorizontalBarChartAction->addTo( optionsMenu ); + optionsVerticalBarChartAction->addTo( optionsMenu ); + optionsMenu->insertSeparator(); + optionsSetFontAction->addTo( optionsMenu ); + optionsMenu->insertSeparator(); + optionsSetOptionsAction->addTo( optionsMenu ); + + menuBar()->insertSeparator(); + + TQPopupMenu *helpMenu = new TQPopupMenu( this ); + menuBar()->insertItem( "&Help", helpMenu ); + helpMenu->insertItem( "&Help", this, SLOT(helpHelp()), Key_F1 ); + helpMenu->insertItem( "&About", this, SLOT(helpAbout()) ); + helpMenu->insertItem( "About &TQt", this, SLOT(helpAboutTQt()) ); m_printer = 0; m_elements.resize( MAX_ELEMENTS ); - TQSettings settings; - settings.insertSearchPath( TQSettings::Windows, WINDOWS_REGISTRY ); - int windowWidth = settings.readNumEntry( APP_KEY + "WindowWidth", 460 ); - int windowHeight = settings.readNumEntry( APP_KEY + "WindowHeight", 530 ); - int windowX = settings.readNumEntry( APP_KEY + "WindowX", -1 ); - int windowY = settings.readNumEntry( APP_KEY + "WindowY", -1 ); + TQSettings settings; + settings.insertSearchPath( TQSettings::Windows, WINDOWS_REGISTRY ); + int windowWidth = settings.readNumEntry( APP_KEY + "WindowWidth", 460 ); + int windowHeight = settings.readNumEntry( APP_KEY + "WindowHeight", 530 ); + int windowX = settings.readNumEntry( APP_KEY + "WindowX", -1 ); + int windowY = settings.readNumEntry( APP_KEY + "WindowY", -1 ); setChartType( ChartType( - settings.readNumEntry( APP_KEY + "ChartType", int(PIE) ) ) ); + settings.readNumEntry( APP_KEY + "ChartType", int(PIE) ) ) ); m_addValues = AddValuesType( - settings.readNumEntry( APP_KEY + "AddValues", int(NO) )); - m_decimalPlaces = settings.readNumEntry( APP_KEY + "Decimals", 2 ); + settings.readNumEntry( APP_KEY + "AddValues", int(NO) )); + m_decimalPlaces = settings.readNumEntry( APP_KEY + "Decimals", 2 ); m_font = TQFont( "Helvetica", 18, TQFont::Bold ); m_font.fromString( - settings.readEntry( APP_KEY + "Font", m_font.toString() ) ); + settings.readEntry( APP_KEY + "Font", m_font.toString() ) ); for ( int i = 0; i < MAX_RECENTFILES; ++i ) { - TQString filename = settings.readEntry( APP_KEY + "File" + - TQString::number( i + 1 ) ); - if ( !filename.isEmpty() ) + TQString filename = settings.readEntry( APP_KEY + "File" + + TQString::number( i + 1 ) ); + if ( !filename.isEmpty() ) m_recentFiles.push_back( filename ); } if ( m_recentFiles.count() ) @@ -459,20 +459,20 @@ const TQString APP_KEY = "/Chart/"; // Connect *after* we've set the chart type on so we don't call // drawElements() prematurely. - connect( chartGroup, SIGNAL( selected(TQAction*) ), + connect( chartGroup, SIGNAL( selected(TQAction*) ), this, SLOT( updateChartType(TQAction*) ) ); - resize( windowWidth, windowHeight ); + resize( windowWidth, windowHeight ); if ( windowX != -1 || windowY != -1 ) - move( windowX, windowY ); + move( windowX, windowY ); - m_canvas = new TQCanvas( this ); - m_canvas->resize( width(), height() ); + m_canvas = new TQCanvas( this ); + m_canvas->resize( width(), height() ); m_canvasView = new CanvasView( m_canvas, &m_elements, this ); - setCentralWidget( m_canvasView ); - m_canvasView->show(); + setCentralWidget( m_canvasView ); + m_canvasView->show(); - if ( !filename.isEmpty() ) + if ( !filename.isEmpty() ) load( filename ); else { init(); @@ -484,7 +484,7 @@ const TQString APP_KEY = "/Chart/"; drawElements(); } - statusBar()->message( "Ready", 2000 ); + statusBar()->message( "Ready", 2000 ); } @@ -496,7 +496,7 @@ ChartForm::~ChartForm() void ChartForm::init() { - setCaption( "Chart" ); + setCaption( "Chart" ); m_filename = TQString::null; m_changed = FALSE; @@ -520,7 +520,7 @@ void ChartForm::init() } } -void ChartForm::closeEvent( TQCloseEvent * ) +void ChartForm::closeEvent( TQCloseEvent * ) { fileQuit(); } @@ -540,25 +540,25 @@ void ChartForm::fileOpen() if ( !okToClear() ) return; - TQString filename = TQFileDialog::getOpenFileName( + TQString filename = TQFileDialog::getOpenFileName( TQString::null, "Charts (*.cht)", this, "file open", "Chart -- File Open" ); - if ( !filename.isEmpty() ) + if ( !filename.isEmpty() ) load( filename ); else - statusBar()->message( "File Open abandoned", 2000 ); + statusBar()->message( "File Open abandoned", 2000 ); } void ChartForm::fileSaveAs() { - TQString filename = TQFileDialog::getSaveFileName( + TQString filename = TQFileDialog::getSaveFileName( TQString::null, "Charts (*.cht)", this, "file save as", "Chart -- File Save As" ); - if ( !filename.isEmpty() ) { + if ( !filename.isEmpty() ) { int answer = 0; - if ( TQFile::exists( filename ) ) - answer = TQMessageBox::warning( + if ( TQFile::exists( filename ) ) + answer = TQMessageBox::warning( this, "Chart -- Overwrite File", TQString( "Overwrite\n\'%1\'?" ). arg( filename ), @@ -570,7 +570,7 @@ void ChartForm::fileSaveAs() return; } } - statusBar()->message( "Saving abandoned", 2000 ); + statusBar()->message( "Saving abandoned", 2000 ); } @@ -583,7 +583,7 @@ void ChartForm::fileOpenRecent( int index ) } -void ChartForm::updateRecentFiles( const TQString& filename ) +void ChartForm::updateRecentFiles( const TQString& filename ) { if ( m_recentFiles.find( filename ) != m_recentFiles.end() ) return; @@ -599,10 +599,10 @@ void ChartForm::updateRecentFiles( const ChartForm::updateRecentFilesMenu() { for ( int i = 0; i < MAX_RECENTFILES; ++i ) { - if ( fileMenu->findItem( i ) ) - fileMenu->removeItem( i ); + if ( fileMenu->findItem( i ) ) + fileMenu->removeItem( i ); if ( i < int(m_recentFiles.count()) ) - fileMenu->insertItem( TQString( "&%1 %2" ). + fileMenu->insertItem( TQString( "&%1 %2" ). arg( i + 1 ).arg( m_recentFiles[i] ), this, SLOT( fileOpenRecent(int) ), 0, i ); @@ -614,7 +614,7 @@ void ChartForm::fileQuit() { if ( okToClear() ) { saveOptions(); - qApp->exit( 0 ); + qApp->exit( 0 ); } } @@ -622,14 +622,14 @@ void ChartForm::fileQuit() bool ChartForm::okToClear() { if ( m_changed ) { - TQString msg; + TQString msg; if ( m_filename.isEmpty() ) msg = "Unnamed chart "; else msg = TQString( "Chart '%1'\n" ).arg( m_filename ); msg += "has been changed."; - int x = TQMessageBox::information( this, "Chart -- Unsaved Changes", + int x = TQMessageBox::information( this, "Chart -- Unsaved Changes", msg, "&Save", "Cancel", "&Abandon", 0, 1 ); switch( x ) { @@ -650,18 +650,18 @@ bool ChartForm::okToClear() void ChartForm::saveOptions() { - TQSettings settings; - settings.insertSearchPath( TQSettings::Windows, WINDOWS_REGISTRY ); - settings.writeEntry( APP_KEY + "WindowWidth", width() ); - settings.writeEntry( APP_KEY + "WindowHeight", height() ); - settings.writeEntry( APP_KEY + "WindowX", x() ); - settings.writeEntry( APP_KEY + "WindowY", y() ); - settings.writeEntry( APP_KEY + "ChartType", int(m_chartType) ); - settings.writeEntry( APP_KEY + "AddValues", int(m_addValues) ); - settings.writeEntry( APP_KEY + "Decimals", m_decimalPlaces ); - settings.writeEntry( APP_KEY + "Font", m_font.toString() ); + TQSettings settings; + settings.insertSearchPath( TQSettings::Windows, WINDOWS_REGISTRY ); + settings.writeEntry( APP_KEY + "WindowWidth", width() ); + settings.writeEntry( APP_KEY + "WindowHeight", height() ); + settings.writeEntry( APP_KEY + "WindowX", x() ); + settings.writeEntry( APP_KEY + "WindowY", y() ); + settings.writeEntry( APP_KEY + "ChartType", int(m_chartType) ); + settings.writeEntry( APP_KEY + "AddValues", int(m_addValues) ); + settings.writeEntry( APP_KEY + "Decimals", m_decimalPlaces ); + settings.writeEntry( APP_KEY + "Font", m_font.toString() ); for ( int i = 0; i < int(m_recentFiles.count()); ++i ) - settings.writeEntry( APP_KEY + "File" + TQString::number( i + 1 ), + settings.writeEntry( APP_KEY + "File" + TQString::number( i + 1 ), m_recentFiles[i] ); } @@ -669,7 +669,7 @@ void ChartForm::saveOptions() void ChartForm::optionsSetData() { SetDataForm *setDataForm = new SetDataForm( &m_elements, m_decimalPlaces, this ); - if ( setDataForm->exec() ) { + if ( setDataForm->exec() ) { m_changed = TRUE; drawElements(); } @@ -682,19 +682,19 @@ void ChartForm::setChartType( ChartType chartType ) m_chartType = chartType; switch ( m_chartType ) { case PIE: - optionsPieChartAction->setOn( TRUE ); + optionsPieChartAction->setOn( TRUE ); break; case VERTICAL_BAR: - optionsVerticalBarChartAction->setOn( TRUE ); + optionsVerticalBarChartAction->setOn( TRUE ); break; case HORIZONTAL_BAR: - optionsHorizontalBarChartAction->setOn( TRUE ); + optionsHorizontalBarChartAction->setOn( TRUE ); break; } } -void ChartForm::updateChartType( TQAction *action ) +void ChartForm::updateChartType( TQAction *action ) { if ( action == optionsPieChartAction ) { m_chartType = PIE; @@ -713,7 +713,7 @@ void ChartForm::updateChartType( TQAct void ChartForm::optionsSetFont() { bool ok; - TQFont font = TQFontDialog::getFont( &ok, m_font, this ); + TQFont font = TQFontDialog::getFont( &ok, m_font, this ); if ( ok ) { m_font = font; drawElements(); @@ -725,7 +725,7 @@ void ChartForm::optionsSetOptions() { OptionsForm *optionsForm = new OptionsForm( this ); optionsForm->chartTypeComboBox->setCurrentItem( m_chartType ); - optionsForm->setFont( m_font ); + optionsForm->setFont( m_font ); switch ( m_addValues ) { case NO: optionsForm->noRadioButton->setChecked( TRUE ); @@ -738,10 +738,10 @@ void ChartForm::optionsSetOptions() break; } optionsForm->decimalPlacesSpinBox->setValue( m_decimalPlaces ); - if ( optionsForm->exec() ) { + if ( optionsForm->exec() ) { setChartType( ChartType( optionsForm->chartTypeComboBox->currentItem()) ); - m_font = optionsForm->font(); + m_font = optionsForm->font(); if ( optionsForm->noRadioButton->isChecked() ) m_addValues = NO; else if ( optionsForm->yesRadioButton->isChecked() ) @@ -757,13 +757,13 @@ void ChartForm::optionsSetOptions() void ChartForm::helpHelp() { - statusBar()->message( "Help is not implemented yet", 2000 ); + statusBar()->message( "Help is not implemented yet", 2000 ); } void ChartForm::helpAbout() { - TQMessageBox::about( this, "Chart -- About", + TQMessageBox::about( this, "Chart -- About", "<center><h1><font color=blue>Chart<font></h1></center>" "<p>Chart your data with <i>chart</i>.</p>" ); @@ -772,33 +772,33 @@ void ChartForm::helpAbout() void ChartForm::helpAboutTQt() { - TQMessageBox::aboutTQt( this, "Chart -- About TQt" ); + TQMessageBox::aboutTQt( this, "Chart -- About TQt" ); }


Main: -

#include <qapplication.h>
+

#include <ntqapplication.h>
 #include "chartform.h"
 
 
 int main( int argc, char *argv[] )
 {
-    TQApplication app( argc, argv );
+    TQApplication app( argc, argv );
 
-    TQString filename;
-    if ( app.argc() > 1 ) {
-        filename = app.argv()[1];
-        if ( !filename.endsWith( ".cht" ) )
+    TQString filename;
+    if ( app.argc() > 1 ) {
+        filename = app.argv()[1];
+        if ( !filename.endsWith( ".cht" ) )
             filename = TQString::null;
     }
 
     ChartForm *cf = new ChartForm( filename );
-    app.setMainWidget( cf );
-    cf->show();
+    app.setMainWidget( cf );
+    cf->show();
 
-    return app.exec();
+    return app.exec();
 }
 
-- cgit v1.2.1