Jump to content

Translations:Development/Tutorials/Qt4 Ruby Tutorial/Chapter 05/25/ru: Difference between revisions

From KDE TechBase
Aspotashev (talk | contribs)
Created page with "Метод [http://doc.qt.nokia.com/latest/qwidget.html#setLayout Qt::Widget::setLayout()] устанавливает объект компоновки для виджета. П..."
 
(No difference)

Latest revision as of 17:30, 2 July 2011

Information about message (contribute)
This message has no documentation. If you know where or how this message is used, you can help other translators by adding documentation to this message.
Message definition (Development/Tutorials/Qt4 Ruby Tutorial/Chapter 05)
The [http://doc.qt.nokia.com/latest/qwidget.html#setLayout Qt::Widget::setLayout()] function installs the layout on '''<tt>MyWidget</tt>'''. This makes the layout a child widget of '''<tt>MyWidget</tt>''' so we don't have to worry about deleting it; it will be deleted together with '''<tt>MyWidget</tt>'''. Also, the call to [http://doc.qt.nokia.com/latest/qwidget.html#setLayout Qt::Widget::setLayout()] automatically reparents the widgets in the layout so that they are children of '''<tt>MyWidget</tt>'''. Because of this, we didn't need to specify '''<tt>self</tt>''' as the parent for the '''<tt>quit</tt>''', '''<tt>lcd</tt>''', and '''<tt>slider</tt>''' widgets.

Метод Qt::Widget::setLayout() устанавливает объект компоновки для виджета. При этом объект компоновки (layout) становится дочерним виджетом виджета MyWidget, так что нам не нужно заботиться о его удалении, он будет удалён вместе с виджетом MyWidget. Кроме того, при вызове Qt::Widget::setLayout() виджеты из объекта компоновки автоматически становятся дочерними виджетами виджета MyWidget. Поэтому не нужно явно устанавливать self в качестве родительского виджета для виджетов quit, lcd и slider.