CopperSpice API
1.9.2
|
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 is used by custom layouts.
Pure virtual methods 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 method 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. Override this method in layout managers which 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 method hasHeightForWidth() will typically be much faster than calling this method and testing for -1.
Override this method in layout managers which support height for width. The following example shows a typical implementation.
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 |
Override this method and return whether this item is empty or contains any widgets.
Implemented in QWidgetItem::isEmpty(), QLayout::isEmpty(), QSpacerItem::isEmpty()
|
virtual |
If this item contains a QLayout, then a pointer to the QLayout is returned, otherwise a nullptr is returned.
Reimplemented in QLayout::layout()
|
pure virtual |
Override this method 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 |
Override this method 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 |
Override this method 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 |
Override this method 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 contains a QSpacerItem, then a pointer to the QSpacerItem is returned, otherwise a nullptr is returned.
Reimplemented in QSpacerItem::spacerItem()
|
virtual |
If this item contains a QWidget, then a pointer to the QWidget is returned, otherwise a nullptr is returned.
Reimplemented in QWidgetItem::widget()