diff options
Diffstat (limited to 'doc/html/tutorial1-14.html')
-rw-r--r-- | doc/html/tutorial1-14.html | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/html/tutorial1-14.html b/doc/html/tutorial1-14.html index 094c8081c..c0fcc00fe 100644 --- a/doc/html/tutorial1-14.html +++ b/doc/html/tutorial1-14.html @@ -95,7 +95,7 @@ not pressed on the barrel. </pre> <p> Now that we have a barrier, there are three ways to miss. We test for the third, too. -<p> <pre> void CannonField::<a href="ntqwidget.html#mousePressEvent">mousePressEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) +<p> <pre> void CannonField::<a href="tqwidget.html#mousePressEvent">mousePressEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) { if ( e-><a href="qmouseevent.html#button">button</a>() != LeftButton ) return; @@ -111,23 +111,23 @@ is within the cannon's barrel. If it is, we set <tt>barrelPressed</tt> to TRUE. <p> Notice that the pos() function returns a point in the widget's coordinate system. -<p> <pre> void CannonField::<a href="ntqwidget.html#mouseMoveEvent">mouseMoveEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) +<p> <pre> void CannonField::<a href="tqwidget.html#mouseMoveEvent">mouseMoveEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) { if ( !barrelPressed ) return; <a href="ntqpoint.html">TQPoint</a> pnt = e-><a href="qmouseevent.html#pos">pos</a>(); <a name="x2424"></a> if ( pnt.<a href="ntqpoint.html#x">x</a>() <= 0 ) <a name="x2422"></a> pnt.<a href="ntqpoint.html#setX">setX</a>( 1 ); - <a name="x2425"></a> if ( pnt.<a href="ntqpoint.html#y">y</a>() >= <a href="ntqwidget.html#height">height</a>() ) - <a name="x2423"></a> pnt.<a href="ntqpoint.html#setY">setY</a>( <a href="ntqwidget.html#height">height</a>() - 1 ); - double rad = atan(((double)<a href="ntqwidget.html#rect">rect</a>().bottom()-pnt.<a href="ntqpoint.html#y">y</a>())/pnt.<a href="ntqpoint.html#x">x</a>()); + <a name="x2425"></a> if ( pnt.<a href="ntqpoint.html#y">y</a>() >= <a href="tqwidget.html#height">height</a>() ) + <a name="x2423"></a> pnt.<a href="ntqpoint.html#setY">setY</a>( <a href="tqwidget.html#height">height</a>() - 1 ); + double rad = atan(((double)<a href="tqwidget.html#rect">rect</a>().bottom()-pnt.<a href="ntqpoint.html#y">y</a>())/pnt.<a href="ntqpoint.html#x">x</a>()); setAngle( tqRound ( rad*180/3.14159265 ) ); } </pre> <p> This is another TQt event handler. It is called when the user already has pressed the mouse button inside this widget and then moves/drags the mouse. (You can make TQt send mouse move events even when no -buttons are pressed. See <a href="ntqwidget.html#setMouseTracking">TQWidget::setMouseTracking</a>().) +buttons are pressed. See <a href="tqwidget.html#setMouseTracking">TQWidget::setMouseTracking</a>().) <p> This handler repositions the cannon's barrel according to the position of the mouse cursor. <p> First, if the barrel is not pressed, we return. Next, we fetch the @@ -138,7 +138,7 @@ the imaginary line between the bottom-left corner of the widget and the cursor position. Finally we set the cannon's angle to the new value converted to degrees. <p> Remember that setAngle() redraws the cannon. -<p> <pre> <a name="x2432"></a>void CannonField::<a href="ntqwidget.html#mouseReleaseEvent">mouseReleaseEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) +<p> <pre> <a name="x2432"></a>void CannonField::<a href="tqwidget.html#mouseReleaseEvent">mouseReleaseEvent</a>( <a href="qmouseevent.html">TQMouseEvent</a> *e ) { <a name="x2417"></a> if ( e-><a href="qmouseevent.html#button">button</a>() == LeftButton ) barrelPressed = FALSE; |