diff options
Diffstat (limited to 'doc/html/tutorial1-08.html')
-rw-r--r-- | doc/html/tutorial1-08.html | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/doc/html/tutorial1-08.html b/doc/html/tutorial1-08.html index 25d8479a9..fb88d4bdb 100644 --- a/doc/html/tutorial1-08.html +++ b/doc/html/tutorial1-08.html @@ -63,38 +63,38 @@ Until now, it has been fixed at 0..99. <p> <pre> void LCDRange::setRange( int minVal, int maxVal ) { if ( minVal < 0 || maxVal > 99 || minVal > maxVal ) { - <a href="qapplication.html#qWarning">qWarning</a>( "LCDRange::setRange(%d,%d)\n" + <a href="ntqapplication.html#qWarning">qWarning</a>( "LCDRange::setRange(%d,%d)\n" "\tRange must be 0..99\n" "\tand minVal must not be greater than maxVal", minVal, maxVal ); return; } - <a name="x2334"></a> slider-><a href="qrangecontrol.html#setRange">setRange</a>( minVal, maxVal ); + <a name="x2334"></a> slider-><a href="ntqrangecontrol.html#setRange">setRange</a>( minVal, maxVal ); } </pre> <p> SetRange() sets the range of the slider in the LCDRange. Because we -have set up the <a href="qlcdnumber.html">TQLCDNumber</a> to always display two digits, we want to +have set up the <a href="ntqlcdnumber.html">TQLCDNumber</a> to always display two digits, we want to limit the possible range of <tt>minVal</tt> and <tt>maxVal</tt> to 0..99 to avoid overflow of the TQLCDNumber. (We could have allowed values down to -9 but chose not to.) If the arguments are illegal, we use TQt's -<a href="qapplication.html#qWarning">qWarning</a>() function to issue a warning to the user and return +<a href="ntqapplication.html#qWarning">qWarning</a>() function to issue a warning to the user and return immediately. qWarning() is a printf-like function that by default sends its output to <tt>stderr</tt>. If you want, you can install your own handler -function using <a href="qapplication.html#qInstallMsgHandler">::qInstallMsgHandler</a>(). +function using <a href="ntqapplication.html#qInstallMsgHandler">::qInstallMsgHandler</a>(). <p> <h3> <a href="t8-cannon-h.html">t8/cannon.h</a> </h3> <a name="1-3"></a><p> CannonField is a new custom widget that knows how to display itself. <p> -<p> <pre> class CannonField : public <a href="qwidget.html">TQWidget</a> +<p> <pre> class CannonField : public <a href="ntqwidget.html">TQWidget</a> { <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> public: - CannonField( <a href="qwidget.html">TQWidget</a> *parent=0, const char *name=0 ); + CannonField( <a href="ntqwidget.html">TQWidget</a> *parent=0, const char *name=0 ); </pre> -<p> CannonField inherits <a href="qwidget.html">TQWidget</a>, and we use the same idiom as for LCDRange. +<p> CannonField inherits <a href="ntqwidget.html">TQWidget</a>, and we use the same idiom as for LCDRange. <p> <pre> int angle() const { return ang; } - <a href="qsizepolicy.html">TQSizePolicy</a> sizePolicy() const; + <a href="ntqsizepolicy.html">TQSizePolicy</a> sizePolicy() const; public slots: void setAngle( int degrees ); @@ -114,13 +114,13 @@ to update itself (i.e., paint the widget's surface). </h3> <a name="1-4"></a><p> -<p> <pre> CannonField::CannonField( <a href="qwidget.html">TQWidget</a> *parent, const char *name ) - : <a href="qwidget.html">TQWidget</a>( parent, name ) +<p> <pre> CannonField::CannonField( <a href="ntqwidget.html">TQWidget</a> *parent, const char *name ) + : <a href="ntqwidget.html">TQWidget</a>( parent, name ) { </pre> <p> Again, we use the same idiom as for LCDRange in the previous chapter. <p> <pre> ang = 45; - <a href="qwidget.html#setPalette">setPalette</a>( TQPalette( TQColor( 250, 250, 200) ) ); + <a href="ntqwidget.html#setPalette">setPalette</a>( TQPalette( TQColor( 250, 250, 200) ) ); } </pre> <p> The constructor initializes the angle value to 45 degrees and sets a @@ -137,7 +137,7 @@ colors will actually be used.) if ( ang == degrees ) return; ang = degrees; - <a href="qwidget.html#repaint">repaint</a>(); + <a href="ntqwidget.html#repaint">repaint</a>(); emit angleChanged( ang ); } </pre> @@ -146,17 +146,17 @@ colors will actually be used.) chosen not to issue a warning if the new angle is out of range. <p> If the new angle equals the old one, we return immediately. It is important to only emit the signal angleChanged() when the angle <em>really</em> has changed. -<p> Then we set the new angle value and repaint our widget. The <a href="qwidget.html#repaint">TQWidget::repaint</a>() function clears the widget (usually filling it with +<p> Then we set the new angle value and repaint our widget. The <a href="ntqwidget.html#repaint">TQWidget::repaint</a>() function clears the widget (usually filling it with its background color) and sends a paint event to the widget. This results in a call to the paint event function of the widget. <p> Finally, we emit the angleChanged() signal to tell the outside world that the angle has changed. The <tt>emit</tt> keyword is unique to TQt and not regular C++ syntax. In fact, it is a macro. -<p> <pre> <a name="x2336"></a>void CannonField::<a href="qwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> * ) +<p> <pre> <a name="x2336"></a>void CannonField::<a href="ntqwidget.html#paintEvent">paintEvent</a>( <a href="qpaintevent.html">TQPaintEvent</a> * ) { - <a href="qstring.html">TQString</a> s = "Angle = " + TQString::number( ang ); - <a href="qpainter.html">TQPainter</a> p( this ); - <a name="x2335"></a> p.<a href="qpainter.html#drawText">drawText</a>( 200, 200, s ); + <a href="ntqstring.html">TQString</a> s = "Angle = " + TQString::number( ang ); + <a href="ntqpainter.html">TQPainter</a> p( this ); + <a name="x2335"></a> p.<a href="ntqpainter.html#drawText">drawText</a>( 200, 200, s ); } </pre> <p> This is our first attempt to write a paint event handler. The event @@ -164,8 +164,8 @@ argument contains a description of the paint event. <a href="qpaintevent.html">T contains the region in the widget that must be updated. For the time being, we will be lazy and just paint everything. <p> Our code displays the angle value in the widget at a fixed position. -First we create a <a href="qstring.html">TQString</a> with some text and the angle; then we create -a <a href="qpainter.html">TQPainter</a> operating on this widget and use it to paint the string. +First we create a <a href="ntqstring.html">TQString</a> with some text and the angle; then we create +a <a href="ntqpainter.html">TQPainter</a> operating on this widget and use it to paint the string. We'll come back to TQPainter later; it can do a great many things. <p> <h3> <a href="t8-main-cpp.html">t8/main.cpp</a> </h3> @@ -174,10 +174,10 @@ We'll come back to TQPainter later; it can do a great many things. <p> <pre> #include "cannon.h" </pre> <p> We include our new class. -<p> <pre> class MyWidget: public <a href="qwidget.html">TQWidget</a> +<p> <pre> class MyWidget: public <a href="ntqwidget.html">TQWidget</a> { public: - MyWidget( <a href="qwidget.html">TQWidget</a> *parent=0, const char *name=0 ); + MyWidget( <a href="ntqwidget.html">TQWidget</a> *parent=0, const char *name=0 ); }; </pre> <p> This time we include a single LCDRange and a CannonField in our top-level @@ -192,9 +192,9 @@ widget. = new CannonField( this, "cannonField" ); </pre> <p> We create our CannonField. -<p> <pre> <a href="qobject.html#connect">connect</a>( angle, SIGNAL(valueChanged(int)), +<p> <pre> <a href="ntqobject.html#connect">connect</a>( angle, SIGNAL(valueChanged(int)), cannonField, SLOT(setAngle(int)) ); - <a href="qobject.html#connect">connect</a>( cannonField, SIGNAL(angleChanged(int)), + <a href="ntqobject.html#connect">connect</a>( cannonField, SIGNAL(angleChanged(int)), angle, SLOT(setValue(int)) ); </pre> <p> Here we connect the valueChanged() signal of the LCDRange to the @@ -213,7 +213,7 @@ loop upon the first change of one of the values. <p> <pre> <a href="qgridlayout.html">TQGridLayout</a> *grid = new <a href="qgridlayout.html">TQGridLayout</a>( this, 2, 2, 10 ); //2x2, 10 pixel border </pre> -<p> So far we have used the no-assembly-required <a href="qvbox.html">TQVBox</a> and <a href="qgrid.html">TQGrid</a> widgets +<p> So far we have used the no-assembly-required <a href="ntqvbox.html">TQVBox</a> and <a href="ntqgrid.html">TQGrid</a> widgets for geometry management. Now, however, we want to have a little more control over the layout, and we switch to the more powerful <a href="qgridlayout.html">TQGridLayout</a> class. TQGridLayout isn't a widget; it is a different class that can @@ -244,7 +244,7 @@ resized. </pre> <p> We set an initial angle value. Note that this will trigger the connection from LCDRange to CannonField. -<p> <pre> <a name="x2339"></a> angle-><a href="qwidget.html#setFocus">setFocus</a>(); +<p> <pre> <a name="x2339"></a> angle-><a href="ntqwidget.html#setFocus">setFocus</a>(); </pre> <p> Our last action is to set <tt>angle</tt> to have <a href="focus.html#keyboard-focus">keyboard focus</a> so that keyboard input will go to the LCDRange widget by default. @@ -252,11 +252,11 @@ keyboard input will go to the LCDRange widget by default. to be terribly useful. However, its constructor just got a new line: <p> -<pre> <a href="qwidget.html#setFocusProxy">setFocusProxy</a>( slider ); +<pre> <a href="ntqwidget.html#setFocusProxy">setFocusProxy</a>( slider ); </pre> <p> The LCDRange sets the slider to be its focus proxy. That means that when someone (the program or the user) wants to give the LCDRange -keyboard focus, the slider should take care of it. <a href="qslider.html">TQSlider</a> has a decent +keyboard focus, the slider should take care of it. <a href="ntqslider.html">TQSlider</a> has a decent keyboard interface, so with just one line of code we've given LCDRange one. <p> <h2> Behavior @@ -278,7 +278,7 @@ and size? Why? <p> If you give the left-hand column a non-zero stretch factor, what happens when you resize the window? <p> Leave out the setFocus() call. Which behavior do you prefer? -<p> Try to change "Quit" to "&Quit" in the <a href="qbutton.html#setText">TQButton::setText</a>() call. How +<p> Try to change "Quit" to "&Quit" in the <a href="ntqbutton.html#setText">TQButton::setText</a>() call. How does the button's look change? What happens if you press Alt+Q while the program's running? (It is Meta+Q on a few keyboards.) <p> Center the text in the CannonField. |