Translate
Appearance
Text
This page always uses small font size
Width
AllDevelopment/Tutorials/Qt4 Ruby Tutorial/Chapter 10
Translate to قازاقشا (جۇنگو)
Translation of the wiki page Development/Tutorials/Qt4 Ruby Tutorial/Chapter 10 from English (en).
This tool does not work without JavaScript. JavaScript is disabled, failed to work, or this browser is unsupported.
Translations:Development/Tutorials/Qt4 Ruby Tutorial/Chapter 10/Page display title/kk-cn
Development/Tutorials/Qt4 Ruby Tutorial/Chapter 10
You need translation rights to translate messages.Get permission
Loading...
Latest updatesAll changes
Suggestions
In other languages
Need more help?Ask for more information
Translations:Development/Tutorials/Qt4 Ruby Tutorial/Chapter 10/1/kk-cn
TutorialBrowser
You need translation rights to translate messages.Get permission
Loading...
Latest updatesAll changes
Suggestions
In other languages
Need more help?Ask for more information
We have made a slight change in the '''<tt>setAngle()</tt>''' function. It repaints only the portion of the widget that contains the cannon.
The implementation of '''<tt>setForce()</tt>''' is quite similar to that of '''<tt>setAngle()</tt>'''. The only difference is that because we don't show the force value, we don't need to repaint the widget.
The '''<tt>cannonRect()</tt>''' function returns the rectangle enclosing the cannon in widget coordinates. First we create a rectangle with the size 50 x 50 and then move it so its bottom-left corner is equal to the widget's own bottom-left corner.
The [http://doc.qt.nokia.com/latest/qwidget.html#rect-prop Qt::Widget::rect()] function returns the widget's enclosing rectangle in the widget's own coordinates. The top-left corner of the rectangle is always (0, 0).
We connect the '''<tt>force</tt>''' widget and the '''<tt>cannonField</tt>''' widget, just like we did for the '''<tt>angle</tt>''' widget.
In Chapter 9, we put '''<tt>angle</tt>''' in the lower-left cell of the layout. Now we want to have two widgets in that cell, so we make a vertical box, put the vertical box in the grid cell, and put each of '''<tt>angle</tt>''' and '''<tt>range</tt>''' in the vertical box.
Try adding a better keyboard interface. For example, make + and - increase and decrease the force and enter shoot. If you're bothered by the way the '''<tt>Left</tt>''' and '''<tt>Right</tt>''' keys work, change that too. [Hint: Reimplement [http://doc.qt.nokia.com/latest/qwidget.html#keyPressEvent Qt::Widget::keyPressEvent()].]
Loading messages...
0% translated, 0% reviewed
Retrieved from "https://techbase.kde.org/Special:Translate"