diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-01-26 23:32:43 -0600 |
commit | ea318d1431c89e647598c510c4245c6571aa5f46 (patch) | |
tree | 996d29b80c30d453dda86d1a23162d441628f169 /doc/html/tutorial2-03.html | |
parent | aaf89d4b48f69c9293feb187db26362e550b5561 (diff) | |
download | tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.tar.gz tqt3-ea318d1431c89e647598c510c4245c6571aa5f46.zip |
Update to latest tqt3 automated conversion
Diffstat (limited to 'doc/html/tutorial2-03.html')
-rw-r--r-- | doc/html/tutorial2-03.html | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/doc/html/tutorial2-03.html b/doc/html/tutorial2-03.html index bbc193b80..1aa7f23c6 100644 --- a/doc/html/tutorial2-03.html +++ b/doc/html/tutorial2-03.html @@ -40,10 +40,10 @@ access for data elements. <pre> private: </pre><pre> double m_value; - <a href="qcolor.html">TQColor</a> m_valueColor; + <a href="ntqcolor.html">TQColor</a> m_valueColor; int m_valuePattern; - <a href="qstring.html">TQString</a> m_label; - <a href="qcolor.html">TQColor</a> m_labelColor; + <a href="ntqstring.html">TQString</a> m_label; + <a href="ntqcolor.html">TQColor</a> m_labelColor; double m_propoints[2 * MAX_PROPOINTS]; </pre> <p> Each element has a value. Each value is displayed graphically with a @@ -52,26 +52,26 @@ with them; the label is drawn using the label color and for each type of chart has a (relative) position stored in the <tt>m_propoints</tt> array. <p> -<pre> #include <<a href="qcolor-h.html">qcolor.h</a>> - #include <<a href="qnamespace-h.html">qnamespace.h</a>> - #include <<a href="qstring-h.html">qstring.h</a>> - #include <<a href="qvaluevector-h.html">qvaluevector.h</a>> +<pre> #include <<a href="qcolor-h.html">ntqcolor.h</a>> + #include <<a href="qnamespace-h.html">ntqnamespace.h</a>> + #include <<a href="qstring-h.html">ntqstring.h</a>> + #include <<a href="qvaluevector-h.html">ntqvaluevector.h</a>> </pre> <p> Although the <tt>Element</tt> class is a purely internal data class, it <tt>#include</tt>s four TQt classes. TQt is often perceived as a purely GUI toolkit, but it provides many non-GUI classes to support most aspects -of application programming. We use <a href="qcolor-h.html">qcolor.h</a> so that we can hold the -paint color and text color in the <tt>Element</tt> class. The use of <a href="qnamespace-h.html">qnamespace.h</a> is slightly obscure. Most TQt classes are derived from the -<a href="qt.html">TQt</a> superclass which contains various -enumerations. The <tt>Element</tt> class does not derive from <a href="qt.html">TQt</a>, so we need to include <a href="qnamespace-h.html">qnamespace.h</a> to have access to +of application programming. We use <a href="qcolor-h.html">ntqcolor.h</a> so that we can hold the +paint color and text color in the <tt>Element</tt> class. The use of <a href="qnamespace-h.html">ntqnamespace.h</a> is slightly obscure. Most TQt classes are derived from the +<a href="ntqt.html">TQt</a> superclass which contains various +enumerations. The <tt>Element</tt> class does not derive from <a href="ntqt.html">TQt</a>, so we need to include <a href="qnamespace-h.html">ntqnamespace.h</a> to have access to the TQt enum names. An alternative approach would have been to have -made <tt>Element</tt> a <a href="qt.html">TQt</a> subclass. We include <a href="qstring-h.html">qstring.h</a> to make use of TQt's Unicode strings. As a convenience we +made <tt>Element</tt> a <a href="ntqt.html">TQt</a> subclass. We include <a href="qstring-h.html">ntqstring.h</a> to make use of TQt's Unicode strings. As a convenience we will <tt>typedef</tt> a vector container for <tt>Element</tt>s, which is why we -pull in the <a href="qvaluevector-h.html">qvaluevector.h</a> header. +pull in the <a href="qvaluevector-h.html">ntqvaluevector.h</a> header. <p> <pre> typedef TQValueVector<Element> ElementVector; </pre> <p> TQt provides a number of containers, some value based like -<a href="qvaluevector.html">TQValueVector</a>, and others pointer based. (See <a href="collection.html">Collection Classes</a>.) Here we've just typedefed one container +<a href="ntqvaluevector.html">TQValueVector</a>, and others pointer based. (See <a href="collection.html">Collection Classes</a>.) Here we've just typedefed one container type; we will keep each data set of elements in one <tt>ElementVector</tt>. <p> <pre> const double EPSILON = 0.0000001; // Must be > INVALID. </pre> @@ -114,8 +114,8 @@ and dynamically resized it depending on how many chart types are available. <p> <pre> Element( double value = INVALID, TQColor valueColor = TQt::gray, int valuePattern = TQt::SolidPattern, - const <a href="qstring.html">TQString</a>& label = <a href="qstring.html#TQString-null">TQString::null</a>, - <a href="qcolor.html">TQColor</a> labelColor = TQt::black ) { + const <a href="ntqstring.html">TQString</a>& label = <a href="ntqstring.html#TQString-null">TQString::null</a>, + <a href="ntqcolor.html">TQColor</a> labelColor = TQt::black ) { init( value, valueColor, valuePattern, label, labelColor ); for ( int i = 0; i < MAX_PROPOINTS * 2; ++i ) m_propoints[i] = NO_PROPORTION; @@ -136,7 +136,7 @@ with the isValid() function. <pre> double Element::proX( int index ) const { - <a href="qapplication.html#Q_ASSERT">Q_ASSERT</a>(index >= 0 && index < MAX_PROPOINTS); + <a href="ntqapplication.html#Q_ASSERT">Q_ASSERT</a>(index >= 0 && index < MAX_PROPOINTS); return m_propoints[2 * index]; } </pre> @@ -153,8 +153,8 @@ index; (see <a href="debug.html">Debugging</a>). <a name="1"></a><p> (Extracts from <tt>element.h</tt>.) <p> -<pre> TQTextStream &operator<<( <a href="qtextstream.html">TQTextStream</a>&, const Element& ); - TQTextStream &operator>>( <a href="qtextstream.html">TQTextStream</a>&, Element& ); +<pre> TQTextStream &operator<<( <a href="ntqtextstream.html">TQTextStream</a>&, const Element& ); + TQTextStream &operator>>( <a href="ntqtextstream.html">TQTextStream</a>&, Element& ); </pre> <p> To make our <tt>Element</tt> class more self-contained we provide overloads for the << and >> operators so that <tt>Element</tt>s may be written to @@ -167,10 +167,10 @@ filter the data using a scripting language. <pre> #include "element.h" - #include <<a href="qstringlist-h.html">qstringlist.h</a>> - #include <<a href="qtextstream-h.html">qtextstream.h</a>> + #include <<a href="qstringlist-h.html">ntqstringlist.h</a>> + #include <<a href="qtextstream-h.html">ntqtextstream.h</a>> </pre> -<p> Our implementation of the operators requires the inclusion of <a href="qtextstream-h.html">qtextstream.h</a> and <a href="qstringlist-h.html">qstringlist.h</a>. +<p> Our implementation of the operators requires the inclusion of <a href="qtextstream-h.html">ntqtextstream.h</a> and <a href="qstringlist-h.html">ntqstringlist.h</a>. <p> <pre> const char FIELD_SEP = ':'; const char PROPOINT_SEP = ';'; const char XY_SEP = ','; @@ -190,7 +190,7 @@ label text. For example: <p> There's no problem having whitespace and field separators in label text due to the way we read <tt>Element</tt> data. -<p> <pre> TQTextStream &operator<<( <a href="qtextstream.html">TQTextStream</a> &s, const Element &element ) +<p> <pre> TQTextStream &operator<<( <a href="ntqtextstream.html">TQTextStream</a> &s, const Element &element ) { s << element.value() << FIELD_SEP << element.valueColor().name() << FIELD_SEP @@ -210,39 +210,39 @@ text due to the way we read <tt>Element</tt> data. <p> Writing elements is straight-forward. Each member is written followed by a field separator. The points are written as comma separated (<tt>XY_SEP</tt>) x, y pairs, each pair separated by the <tt>PROPOINT_SEP</tt> separator. The final field is the label followed by a newline. -<p> <pre> TQTextStream &operator>>( <a href="qtextstream.html">TQTextStream</a> &s, Element &element ) +<p> <pre> TQTextStream &operator>>( <a href="ntqtextstream.html">TQTextStream</a> &s, Element &element ) { - <a name="x2553"></a> <a href="qstring.html">TQString</a> data = s.<a href="qtextstream.html#readLine">readLine</a>(); + <a name="x2553"></a> <a href="ntqstring.html">TQString</a> data = s.<a href="ntqtextstream.html#readLine">readLine</a>(); element.setValue( Element::INVALID ); int errors = 0; bool ok; - <a name="x2552"></a> <a href="qstringlist.html">TQStringList</a> fields = TQStringList::<a href="qstringlist.html#split">split</a>( FIELD_SEP, data ); - <a name="x2555"></a> if ( fields.<a href="qvaluelist.html#count">count</a>() >= 4 ) { + <a name="x2552"></a> <a href="ntqstringlist.html">TQStringList</a> fields = TQStringList::<a href="ntqstringlist.html#split">split</a>( FIELD_SEP, data ); + <a name="x2555"></a> if ( fields.<a href="ntqvaluelist.html#count">count</a>() >= 4 ) { double value = fields[0].toDouble( &ok ); if ( !ok ) errors++; - <a href="qcolor.html">TQColor</a> valueColor = TQColor( fields[1] ); - <a name="x2550"></a> if ( !valueColor.<a href="qcolor.html#isValid">isValid</a>() ) + <a href="ntqcolor.html">TQColor</a> valueColor = TQColor( fields[1] ); + <a name="x2550"></a> if ( !valueColor.<a href="ntqcolor.html#isValid">isValid</a>() ) errors++; int valuePattern = fields[2].toInt( &ok ); if ( !ok ) errors++; - <a href="qcolor.html">TQColor</a> labelColor = TQColor( fields[3] ); - if ( !labelColor.<a href="qcolor.html#isValid">isValid</a>() ) + <a href="ntqcolor.html">TQColor</a> labelColor = TQColor( fields[3] ); + if ( !labelColor.<a href="ntqcolor.html#isValid">isValid</a>() ) errors++; - <a href="qstringlist.html">TQStringList</a> propoints = TQStringList::<a href="qstringlist.html#split">split</a>( PROPOINT_SEP, fields[4] ); - <a name="x2551"></a> <a href="qstring.html">TQString</a> label = data.<a href="qstring.html#section">section</a>( FIELD_SEP, 5 ); + <a href="ntqstringlist.html">TQStringList</a> propoints = TQStringList::<a href="ntqstringlist.html#split">split</a>( PROPOINT_SEP, fields[4] ); + <a name="x2551"></a> <a href="ntqstring.html">TQString</a> label = data.<a href="ntqstring.html#section">section</a>( FIELD_SEP, 5 ); if ( !errors ) { element.set( value, valueColor, valuePattern, label, labelColor ); int i = 0; - <a name="x2554"></a> for ( TQStringList::iterator point = propoints.<a href="qvaluelist.html#begin">begin</a>(); - <a name="x2556"></a> i < Element::MAX_PROPOINTS && point != propoints.<a href="qvaluelist.html#end">end</a>(); + <a name="x2554"></a> for ( TQStringList::iterator point = propoints.<a href="ntqvaluelist.html#begin">begin</a>(); + <a name="x2556"></a> i < Element::MAX_PROPOINTS && point != propoints.<a href="ntqvaluelist.html#end">end</a>(); ++i, ++point ) { errors = 0; - <a href="qstringlist.html">TQStringList</a> xy = TQStringList::<a href="qstringlist.html#split">split</a>( XY_SEP, *point ); + <a href="ntqstringlist.html">TQStringList</a> xy = TQStringList::<a href="ntqstringlist.html#split">split</a>( XY_SEP, *point ); double x = xy[0].toDouble( &ok ); if ( !ok || x <= 0.0 || x >= 1.0 ) errors++; @@ -261,9 +261,9 @@ separator. The final field is the label followed by a newline. } </pre> <p> To read an element we read one record (i.e. one line). We break the -data into fields using <a href="qstringlist.html#split">TQStringList::split</a>(). Because it is possible +data into fields using <a href="ntqstringlist.html#split">TQStringList::split</a>(). Because it is possible that a label will contain <tt>FIELD_SEP</tt> characters we use -<a href="qstring.html#section">TQString::section</a>() to extract all the text from the last field to the +<a href="ntqstring.html#section">TQString::section</a>() to extract all the text from the last field to the end of the line. If there are enough fields and the value, colors and pattern data is valid we use <tt>Element::set()</tt> to write this data into the element; otherwise we leave the element <tt>INVALID</tt>. We then |