![]() |
CopperSpice API
1.8.1
|
The QLayoutItem class provides an abstract item that a QLayout manipulates. More...
Public Methods | |
QLayoutItem (Qt::Alignment alignment=Qt::Alignment ()) | |
virtual | ~QLayoutItem () |
Qt::Alignment | alignment () const |
virtual QSizePolicy::ControlTypes | controlTypes () const |
virtual Qt::Orientations | expandingDirections () const = 0 |
virtual QRect | geometry () const = 0 |
virtual bool | hasHeightForWidth () const |
virtual int | heightForWidth (int width) const |
virtual void | invalidate () |
virtual bool | isEmpty () const = 0 |
virtual QLayout * | layout () |
virtual QSize | maximumSize () const = 0 |
virtual int | minimumHeightForWidth (int width) const |
virtual QSize | minimumSize () const = 0 |
void | setAlignment (Qt::Alignment alignment) |
virtual void | setGeometry (const QRect &rect) = 0 |
virtual QSize | sizeHint () const = 0 |
virtual QSpacerItem * | spacerItem () |
virtual QWidget * | widget () |
The QLayoutItem class provides an abstract item that a QLayout manipulates. This is used by custom layouts.
Pure virtual functions are provided to return information about the layout, including, sizeHint(), minimumSize(), maximumSize() and expanding().
The layout's geometry can be set and retrieved with setGeometry() and geometry(), and its alignment with setAlignment() and alignment(). The function isEmpty() returns whether the layout item is empty. If the concrete item is a QWidget, it can be retrieved using widget(). Similarly for layout() and spacerItem().
Some layouts have width and height interdependencies. These can be expressed using hasHeightForWidth(), heightForWidth(), and minimumHeightForWidth().
|
inlineexplicit |
Constructs a layout item with an alignment. Not all subclasses support alignment.
|
virtual |
Destroys the QLayoutItem.
|
inline |
Returns the alignment of this item.
|
virtual |
Returns the control type(s) for the layout item. For a QWidgetItem, the control type comes from the widget's size policy; for a QLayoutItem, the control types is derived from the layout's contents.
Reimplemented in QWidgetItem::controlTypes(), QLayout::controlTypes()
|
pure virtual |
Returns whether this layout item can make use of more space than sizeHint(). A value of Qt::Vertical or Qt::Horizontal means that it wants to grow in only one dimension, whereas Qt::Vertical | Qt::Horizontal means that it wants to grow in both dimensions.
Implemented in QFormLayout::expandingDirections(), QWidgetItem::expandingDirections(), QLayout::expandingDirections(), QSpacerItem::expandingDirections(), QBoxLayout::expandingDirections(), QGridLayout::expandingDirections()
|
pure virtual |
Returns the rectangle covered by this layout item.
Implemented in QWidgetItem::geometry(), QLayout::geometry(), QSpacerItem::geometry()
|
virtual |
Returns true if this layout's preferred height depends on its width, otherwise returns false. The default implementation returns false.
Reimplement this function in layout managers that support height for width.
Reimplemented in QFormLayout::hasHeightForWidth(), QWidgetItem::hasHeightForWidth(), QStackedLayout::hasHeightForWidth(), QBoxLayout::hasHeightForWidth(), QGridLayout::hasHeightForWidth()
|
virtual |
Returns the preferred height for this layout item, given the width.
The default implementation returns -1, indicating that the preferred height is independent of the width of the item. Using the function hasHeightForWidth() will typically be much faster than calling this function and testing for -1.
Reimplement this function in layout managers that support height for width. A typical implementation will look like this:
Caching is strongly recommended; without it layout will take exponential time.
Reimplemented in QFormLayout::heightForWidth(), QWidgetItem::heightForWidth(), QStackedLayout::heightForWidth(), QBoxLayout::heightForWidth(), QGridLayout::heightForWidth()
|
virtual |
Invalidates any cached information in this layout item.
Reimplemented in QFormLayout::invalidate(), QLayout::invalidate(), QBoxLayout::invalidate(), QGridLayout::invalidate()
|
pure virtual |
Implemented in subclasses to return whether this item is empty, i.e. whether it contains any widgets.
Implemented in QWidgetItem::isEmpty(), QLayout::isEmpty(), QSpacerItem::isEmpty()
|
virtual |
If this item is a QLayout, it is returned as a QLayout, otherwise 0 is returned. This function provides type-safe casting.
Reimplemented in QLayout::layout()
|
pure virtual |
Implemented in subclasses to return the maximum size of this item.
Implemented in QWidgetItem::maximumSize(), QLayout::maximumSize(), QSpacerItem::maximumSize(), QBoxLayout::maximumSize(), QGridLayout::maximumSize()
|
virtual |
Returns the minimum height this widget needs for the given width. The default implementation simply returns heightForWidth(width).
Reimplemented in QBoxLayout::minimumHeightForWidth(), QGridLayout::minimumHeightForWidth()
|
pure virtual |
Implemented in subclasses to return the minimum size of this item.
Implemented in QFormLayout::minimumSize(), QWidgetItem::minimumSize(), QLayout::minimumSize(), QSpacerItem::minimumSize(), QStackedLayout::minimumSize(), QBoxLayout::minimumSize(), QGridLayout::minimumSize()
void QLayoutItem::setAlignment | ( | Qt::Alignment | alignment | ) |
Sets the alignment of this item to alignment.
Item alignment is only supported by some child classes.
|
pure virtual |
Implemented in subclasses to set this item's geometry to rect.
Implemented in QFormLayout::setGeometry(), QWidgetItem::setGeometry(), QLayout::setGeometry(), QGridLayout::setGeometry(), QSpacerItem::setGeometry(), QBoxLayout::setGeometry(), QStackedLayout::setGeometry()
|
pure virtual |
Implemented in subclasses to return the preferred size of this item.
Implemented in QFormLayout::sizeHint(), QWidgetItem::sizeHint(), QSpacerItem::sizeHint(), QStackedLayout::sizeHint(), QBoxLayout::sizeHint(), QGridLayout::sizeHint()
|
virtual |
If this item is a QSpacerItem, it is returned as a QSpacerItem, otherwise 0 is returned. This function provides type-safe casting.
Reimplemented in QSpacerItem::spacerItem()
|
virtual |
If this item is a QWidget, it is returned as a QWidget, otherwise 0 is returned. This function provides type-safe casting.
Reimplemented in QWidgetItem::widget()