Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |
The TQLayout class is the base class of geometry managers. More...
#include <ntqlayout.h>
Inherits TQObject and TQLayoutItem.
Inherited by TQGridLayout and TQBoxLayout.
This is an abstract base class inherited by the concrete classes, TQBoxLayout and TQGridLayout.
For users of TQLayout subclasses or of TQMainWindow there is seldom any need to use the basic functions provided by TQLayout, such as setResizeMode() or setMenuBar(). See the layout overview page for more information.
To make your own layout manager, subclass TQGLayoutIterator and implement the functions addItem(), sizeHint(), setGeometry(), and iterator(). You should also implement minimumSize() to ensure your layout isn't resized to zero size if there is too little space. To support children whose heights depend on their widths, implement hasHeightForWidth() and heightForWidth(). See the custom layout page for an in-depth description.
Geometry management stops when the layout manager is deleted.
See also Widget Appearance and Style and Layout Management.
The possible values are:
The margin is the number of pixels between the edge of the widget and the managed children. The spacing sets the value of spacing(), which gives the spacing between the managed widgets. If spacing is -1 (the default), spacing is set to the value of margin.
There can be only one top-level layout for a widget. It is returned by TQWidget::layout()
If spacing is -1, this TQLayout inherits parentLayout's spacing(), otherwise the value of spacing is used.
This layout has to be inserted into another layout before geometry management will work.
However, if you set up a TQLayout for a visible widget without resizing that widget, you will need to call this function in order to lay it out.
See also TQWidget::updateGeometry().
Examples: layout/layout.cpp, popup/popup.cpp, scrollview/scrollview.cpp, and sql/overview/form1/main.cpp.
Adds widget w to this layout in a manner specific to the layout. This function uses addItem().
Examples: customlayout/border.cpp and customlayout/main.cpp.
Implemented in subclasses to add an item. How it is added is specific to each subclass.
The ownership of item is transferred to the layout, and it's the layout's responsibility to delete it.
Examples: customlayout/border.cpp, customlayout/card.cpp, and customlayout/flow.cpp.
Reimplemented in TQGridLayout and TQBoxLayout.
The result is derived from sizeHint() and expanding(). It is never larger than r.
Returns TRUE if this layout automatically grabs all new mainWidget()'s new children and adds them as defined by addItem(); otherwise returns FALSE. This has effect only for top-level layouts, i.e. layouts that are direct children of their mainWidget().
autoAdd() is disabled by default.
Note that a top-level layout is not necessarily associated with the top-level widget.
See also setAutoAdd().
The default implementation returns BothDirections.
Examples: customlayout/border.cpp and customlayout/flow.cpp.
Reimplemented from TQLayoutItem.
Reimplemented in TQGridLayout and TQBoxLayout.
Reimplemented from TQLayoutItem.
Reimplemented in TQGridLayout and TQBoxLayout.
Reimplemented from TQLayoutItem.
See also setEnabled().
Returns TRUE if this layout is a top-level layout, i.e. not a child of another layout; otherwise returns FALSE.
Implemented in subclasses to return an iterator that iterates over this layout's children.
A typical implementation will be:
TQLayoutIterator MyLayout::iterator() { TQGLayoutIterator *i = new MyLayoutIterator( internal_data ); return TQLayoutIterator( i ); }where MyLayoutIterator is a subclass of TQGLayoutIterator.
Examples: customlayout/border.cpp, customlayout/card.cpp, and customlayout/flow.cpp.
Reimplemented from TQLayoutItem.
Returns the width of the outside border of the layout. See the "margin" property for details.
The default implementation allows unlimited resizing.
Reimplemented from TQLayoutItem.
Reimplemented in TQGridLayout and TQBoxLayout.
Returns the menu bar set for this layout, or 0 if no menu bar is set.
The default implementation allows unlimited resizing.
Examples: customlayout/border.cpp, customlayout/card.cpp, and customlayout/flow.cpp.
Reimplemented from TQLayoutItem.
Reimplemented in TQGridLayout and TQBoxLayout.
See also removeItem(), TQWidget::geometry, and add().
Notice that item can be a layout (since TQLayout inherits TQLayoutItem).
See also remove() and addItem().
Returns the resize mode of the layout. See the "resizeMode" property for details.
Warning: If auto-add is enabled, you cannot set stretch factors on the child widgets until the widgets are actually inserted in the layout (after control returned to the event loop). We therefore recommend that you avoid the auto-add feature in new programs.
See also autoAdd().
Examples: hierarchy/objects.cpp and i18n/main.cpp.
An enabled layout adjusts dynamically to changes; a disabled layout acts as if it did not exist.
By default all layouts are enabled.
See also isEnabled().
The default implementation maintains the geometry() information given by rect r. Reimplementors must call this function.
Examples: customlayout/border.cpp, customlayout/card.cpp, and customlayout/flow.cpp.
Reimplemented from TQLayoutItem.
Reimplemented in TQGridLayout and TQBoxLayout.
Sets the width of the outside border of the layout. See the "margin" property for details.
A menu bar does its own geometry management: never do addWidget() on a TQMenuBar.
Examples: layout/layout.cpp and scrollview/scrollview.cpp.
Sets the resize mode of the layout. See the "resizeMode" property for details.
Sets the spacing between widgets inside the layout. See the "spacing" property for details.
If b is TRUE, margin handling needs to be implemented in setGeometry(), maximumSize(), minimumSize(), sizeHint() and heightForWidth().
See also supportsMargin().
Returns the spacing between widgets inside the layout. See the "spacing" property for details.
Returns TRUE if this layout supports TQLayout::margin on non-top-level layouts; otherwise returns FALSE.
See also margin.
This property holds the width of the outside border of the layout.
For some layout classes this property has an effect only on top-level layouts; TQBoxLayout and TQGridLayout support margins for child layouts. The default value is 0.
See also spacing.
Set this property's value with setMargin() and get this property's value with margin().
This property holds the resize mode of the layout.
The default mode is Auto.
See also TQLayout::ResizeMode.
Set this property's value with setResizeMode() and get this property's value with resizeMode().
This property holds the spacing between widgets inside the layout.
The default value is -1, which signifies that the layout's spacing should not override the widget's spacing.
See also margin.
Set this property's value with setSpacing() and get this property's value with spacing().
This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.
Copyright © 2007 Trolltech | Trademarks | TQt 3.3.8
|