diff options
Diffstat (limited to 'doc/html/tutorial1-07.html')
-rw-r--r-- | doc/html/tutorial1-07.html | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/doc/html/tutorial1-07.html b/doc/html/tutorial1-07.html index a54ef7803..706ba9ee7 100644 --- a/doc/html/tutorial1-07.html +++ b/doc/html/tutorial1-07.html @@ -57,27 +57,27 @@ Chapter 6; only the changes are noted here. happens to be included more than once. If you don't use it already, it is a very good habit to develop. The #ifndef should enclose <em>all</em> of the header file. -<p> <pre> #include <<a href="qvbox-h.html">qvbox.h</a>> +<p> <pre> #include <<a href="qvbox-h.html">ntqvbox.h</a>> </pre> -<p> <a href="qvbox-h.html">qvbox.h</a> is included. LCDRange inherits <a href="qvbox.html">TQVBox</a>, and the header file +<p> <a href="qvbox-h.html">ntqvbox.h</a> is included. LCDRange inherits <a href="ntqvbox.html">TQVBox</a>, and the header file of a parent class must always be included. We cheated a bit in the -previous chapters, and we let <a href="qwidget-h.html">qwidget.h</a> be included indirectly via -other header files such as <a href="qpushbutton-h.html">qpushbutton.h</a>. +previous chapters, and we let <a href="qwidget-h.html">ntqwidget.h</a> be included indirectly via +other header files such as <a href="qpushbutton-h.html">ntqpushbutton.h</a>. <p> <pre> class TQSlider; </pre> <p> This is another classic trick, but one that's much less used often. Because -we don't need <a href="qslider.html">TQSlider</a> in the <em>interface</em> of the class, only in the +we don't need <a href="ntqslider.html">TQSlider</a> in the <em>interface</em> of the class, only in the implementation, we use a forward declaration of the class in the header file and include the header file for TQSlider in the .cpp file. <p> This makes the compilation of big projects much faster, because when a header file has changed, fewer files need to be recompiled. It can often speed up big compilations by a factor of two or more. -<p> <pre> class LCDRange : public <a href="qvbox.html">TQVBox</a> +<p> <pre> class LCDRange : public <a href="ntqvbox.html">TQVBox</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: - LCDRange( <a href="qwidget.html">TQWidget</a> *parent=0, const char *name=0 ); + LCDRange( <a href="ntqwidget.html">TQWidget</a> *parent=0, const char *name=0 ); </pre> <p> Note the Q_OBJECT. This macro must be included in <em>all</em> classes that contain signals and/or slots. If you are curious, it defines the @@ -110,9 +110,9 @@ signal you'll see called <i>something</i>Changed(). <p> This file is mainly lifted from <a href="tutorial1-06.html#main">t6/main.cpp</a>, and only the changes are noted here. -<p> <pre> <a name="x2333"></a> <a href="qobject.html#connect">connect</a>( slider, SIGNAL(<a href="qslider.html#valueChanged">valueChanged</a>(int)), - <a name="x2330"></a> lcd, SLOT(<a href="qlcdnumber.html#display">display</a>(int)) ); - <a href="qobject.html#connect">connect</a>( slider, SIGNAL(<a href="qslider.html#valueChanged">valueChanged</a>(int)), +<p> <pre> <a name="x2333"></a> <a href="ntqobject.html#connect">connect</a>( slider, SIGNAL(<a href="ntqslider.html#valueChanged">valueChanged</a>(int)), + <a name="x2330"></a> lcd, SLOT(<a href="ntqlcdnumber.html#display">display</a>(int)) ); + <a href="ntqobject.html#connect">connect</a>( slider, SIGNAL(<a href="ntqslider.html#valueChanged">valueChanged</a>(int)), SIGNAL(valueChanged(int)) ); </pre> <p> This code is from the LCDRange constructor. @@ -125,23 +125,23 @@ the first is emitted, the second signal is also emitted. <p> Let's look at what happens when the user operates the slider. The slider sees that its value has changed and emits the valueChanged() signal. That signal is connected both to the display() slot of the -<a href="qlcdnumber.html">TQLCDNumber</a> and to the valueChanged() signal of the LCDRange. +<a href="ntqlcdnumber.html">TQLCDNumber</a> and to the valueChanged() signal of the LCDRange. <p> Thus, when the signal is emitted, LCDRange emits its own -valueChanged() signal. In addition, <a href="qlcdnumber.html#display">TQLCDNumber::display</a>() is called +valueChanged() signal. In addition, <a href="ntqlcdnumber.html#display">TQLCDNumber::display</a>() is called and shows the new number. <p> Note that you're not guaranteed any particular order of execution - LCDRange::valueChanged() may be emitted before or after TQLCDNumber::display()and is entirely arbitrary. <p> <pre> int LCDRange::value() const { - <a name="x2332"></a> return slider-><a href="qslider.html#value">value</a>(); + <a name="x2332"></a> return slider-><a href="ntqslider.html#value">value</a>(); } </pre> <p> The implementation of value() is straightforward; it simply returns the slider's value. <p> <pre> void LCDRange::setValue( int value ) { - <a name="x2331"></a> slider-><a href="qslider.html#setValue">setValue</a>( value ); + <a name="x2331"></a> slider-><a href="ntqslider.html#setValue">setValue</a>( value ); } </pre> <p> The implementation of setValue() is equally straightforward. Note @@ -158,7 +158,7 @@ outside its legal range. for( int c = 0 ; c < 4 ; c++ ) { LCDRange* lr = new LCDRange( grid ); if ( previous ) - <a href="qobject.html#connect">connect</a>( lr, SIGNAL(valueChanged(int)), + <a href="ntqobject.html#connect">connect</a>( lr, SIGNAL(valueChanged(int)), previous, SLOT(setValue(int)) ); previous = lr; } |