source: trunk/doc/html/chart-chartform-h.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 4.4 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/tutorial2.doc:8 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>chart/chartform.h Example File</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>chart/chartform.h Example File</h1>
33
34
35<pre>#ifndef CHARTFORM_H
36#define CHARTFORM_H
37
38#include "element.h"
39
40#include &lt;<a href="qmainwindow-h.html">qmainwindow.h</a>&gt;
41#include &lt;<a href="qstringlist-h.html">qstringlist.h</a>&gt;
42
43
44class CanvasView;
45
46class QAction;
47class QCanvas;
48class QFont;
49class QPrinter;
50class QString;
51
52
53class ChartForm: public <a href="qmainwindow.html">QMainWindow</a>
54{
55 Q_OBJECT
56public:
57 enum { MAX_ELEMENTS = 100 };
58 enum { MAX_RECENTFILES = 9 }; // Must not exceed 9
59 enum ChartType { PIE, VERTICAL_BAR, HORIZONTAL_BAR };
60 enum AddValuesType { NO, YES, AS_PERCENTAGE };
61
62 ChartForm( const <a href="qstring.html">QString</a>&amp; filename );
63 ~ChartForm();
64
65 int chartType() { return m_chartType; }
66 void setChanged( bool changed = TRUE ) { m_changed = changed; }
67 void drawElements();
68
69 <a href="qpopupmenu.html">QPopupMenu</a> *optionsMenu; // Why public? See canvasview.cpp
70
71protected:
72 virtual void closeEvent( <a href="qcloseevent.html">QCloseEvent</a> * );
73
74private slots:
75 void fileNew();
76 void fileOpen();
77 void fileOpenRecent( int index );
78 void fileSave();
79 void fileSaveAs();
80 void fileSaveAsPixmap();
81 void filePrint();
82 void fileQuit();
83 void optionsSetData();
84 void updateChartType( <a href="qaction.html">QAction</a> *action );
85 void optionsSetFont();
86 void optionsSetOptions();
87 void helpHelp();
88 void helpAbout();
89 void helpAboutQt();
90 void saveOptions();
91
92private:
93 void init();
94 void load( const <a href="qstring.html">QString</a>&amp; filename );
95 bool okToClear();
96 void drawPieChart( const double scales[], double total, int count );
97 void drawVerticalBarChart( const double scales[], double total, int count );
98 void drawHorizontalBarChart( const double scales[], double total, int count );
99
100 <a href="qstring.html">QString</a> valueLabel( const <a href="qstring.html">QString</a>&amp; label, double value, double total );
101 void updateRecentFiles( const <a href="qstring.html">QString</a>&amp; filename );
102 void updateRecentFilesMenu();
103 void setChartType( ChartType chartType );
104
105 <a href="qpopupmenu.html">QPopupMenu</a> *fileMenu;
106 <a href="qaction.html">QAction</a> *optionsPieChartAction;
107 <a href="qaction.html">QAction</a> *optionsHorizontalBarChartAction;
108 <a href="qaction.html">QAction</a> *optionsVerticalBarChartAction;
109
110
111 <a href="qstring.html">QString</a> m_filename;
112 <a href="qstringlist.html">QStringList</a> m_recentFiles;
113 <a href="qcanvas.html">QCanvas</a> *m_canvas;
114 CanvasView *m_canvasView;
115 bool m_changed;
116 ElementVector m_elements;
117 <a href="qprinter.html">QPrinter</a> *m_printer;
118 ChartType m_chartType;
119 AddValuesType m_addValues;
120 int m_decimalPlaces;
121 <a href="qfont.html">QFont</a> m_font;
122};
123
124#endif
125</pre><!-- eof -->
126<p><address><hr><div align=center>
127<table width=100% cellspacing=0 border=0><tr>
128<td>Copyright &copy; 2007
129<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
130<td align=right><div align=right>Qt 3.3.8</div>
131</table></div></address></body>
132</html>
Note: See TracBrowser for help on using the repository browser.