diff options
Diffstat (limited to 'doc/layout.doc')
-rw-r--r-- | doc/layout.doc | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/doc/layout.doc b/doc/layout.doc index a57f101fe..388b686c6 100644 --- a/doc/layout.doc +++ b/doc/layout.doc @@ -74,9 +74,9 @@ The easiest way to give your widgets a good layout is to use the layout widgets: \l QHBox, \l QVBox and \l QGrid. A layout widget automatically lays out its child widgets in the order they are constructed. To create more complex layouts, you can nest layout -widgets inside each other. (Note that \l QWidget does not have a +widgets inside each other. (Note that \l TQWidget does not have a layout by default, you must add one if you want to lay out widgets -inside a \l QWidget.) +inside a \l TQWidget.) \list \i A \l QHBox lays out its child widgets in a horizontal row, left to right. @@ -107,14 +107,14 @@ The grid shown above can be produced by the following code: \endcode You can adjust the layout to some extent by calling -QWidget::setMinimumSize() or QWidget::setFixedSize() on the child widgets. +TQWidget::setMinimumSize() or TQWidget::setFixedSize() on the child widgets. \section1 Adding Widgets to a Layout When you add widgets to a layout the layout process works as follows: \list 1 \i All the widgets will initially be allocated an amount of space in -accordance with their QWidget::sizePolicy(). +accordance with their TQWidget::sizePolicy(). \i If any of the widgets have stretch factors set, with a value greater than zero, then they are allocated space in proportion to their \link #stretch stretch factor\endlink. @@ -138,7 +138,7 @@ determining factor.) Widgets are normally created without any stretch factor set. When they are laid out in a layout the widgets are given a share of space in -accordance with their QWidget::sizePolicy() or their minimum size hint +accordance with their TQWidget::sizePolicy() or their minimum size hint whichever is the greater. Stretch factors are used to change how much space widgets are given in proportion to one another. @@ -171,7 +171,7 @@ stretch, and placement. The following code makes a grid like the one above, with a couple of improvements: \code - QWidget *main = new QWidget; + TQWidget *main = new TQWidget; // make a 1x1 grid; it will auto-expand QGridLayout *grid = new QGridLayout( main, 1, 1 ); @@ -195,7 +195,7 @@ improvements: You can insert layouts inside a layout by giving the parent layout as a parameter in the constructor. \code - QWidget *main = new QWidget; + TQWidget *main = new TQWidget; QLineEdit *field = new QLineEdit( main ); QPushButton *ok = new QPushButton( "OK", main ); QPushButton *cancel = new QPushButton( "Cancel", main ); @@ -231,24 +231,24 @@ in-depth description. When you make your own widget class, you should also communicate its layout properties. If the widget has a QLayout, this is already taken care of. If the widget does not have any child widgets, or uses manual -layout, you should reimplement the following QWidget member functions: +layout, you should reimplement the following TQWidget member functions: \list -\i QWidget::sizeHint() returns the preferred size of the widget. -\i QWidget::minimumSizeHint() returns the smallest size the widget can have. -\i QWidget::sizePolicy() returns a \l QSizePolicy; a value describing +\i TQWidget::sizeHint() returns the preferred size of the widget. +\i TQWidget::minimumSizeHint() returns the smallest size the widget can have. +\i TQWidget::sizePolicy() returns a \l QSizePolicy; a value describing the space requirements of the widget. \endlist -Call QWidget::updateGeometry() whenever the size hint, minimum size +Call TQWidget::updateGeometry() whenever the size hint, minimum size hint or size policy changes. This will cause a layout recalculation. Multiple calls to updateGeometry() will only cause one recalculation. If the preferred height of your widget depends on its actual width (e.g. a label with automatic word-breaking), set the \link QSizePolicy::hasHeightForWidth() hasHeightForWidth\endlink() flag in -\link QWidget::sizePolicy() sizePolicy\endlink(), and reimplement \l -QWidget::heightForWidth(). +\link TQWidget::sizePolicy() sizePolicy\endlink(), and reimplement \l +TQWidget::heightForWidth(). Even if you implement heightForWidth(), it is still necessary to provide a good sizeHint(). The sizeHint() provides the preferred width @@ -262,13 +262,13 @@ requirements to your new widget. \section1 Manual Layout If you are making a one-of-a-kind special layout, you can also make a -custom widget as described above. Reimplement QWidget::resizeEvent() +custom widget as described above. Reimplement TQWidget::resizeEvent() to calculate the required distribution of sizes and call \link -QWidget::setGeometry() setGeometry\endlink() on each child. +TQWidget::setGeometry() setGeometry\endlink() on each child. The widget will get an event with \link QEvent::type() type \endlink \c LayoutHint when the layout needs to be recalculated. Reimplement -QWidget::event() to be notified of \c LayoutHint events. +TQWidget::event() to be notified of \c LayoutHint events. \section1 Layout Issues @@ -324,7 +324,7 @@ minimumSize\endlink(). class CardLayout : public QLayout { public: - CardLayout( QWidget *parent, int dist ) + CardLayout( TQWidget *parent, int dist ) : QLayout( parent, 0, dist ) {} CardLayout( QLayout* parent, int dist) : QLayout( parent, dist ) { } @@ -416,7 +416,7 @@ void CardLayout::addItem( QLayoutItem *item ) \endcode The layout takes over responsibility of the items added. Since -QLayoutItem does not inherit QObject, we must delete the items +QLayoutItem does not inherit TQObject, we must delete the items manually. The function QLayout::deleteAllItems() uses the iterator we defined above to delete all the items in the layout. |