Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QGraphicsLayout

    java.lang.Object
      com.trolltech.qt.QSignalEmitter
          com.trolltech.qt.QtJambiObject
              com.trolltech.qt.gui.QGraphicsLayout

All Implemented Interfaces:
  QGraphicsLayoutItemInterface, QtJambiInterface

Direct Known Subclasses:
  QGraphicsGridLayout, QGraphicsLinearLayout

    public abstract class QGraphicsLayout

extends QtJambiObject
implements QGraphicsLayoutItemInterface

The `QGraphicsLayout` class provides the base class for all layouts in Graphics View. `QGraphicsLayout` is an abstract class that defines a virtual API for arranging `QGraphicsWidget` children and other `QGraphicsLayoutItem` objects for a `QGraphicsWidget`. `QGraphicsWidget` assigns responsibility to a `QGraphicsLayout` through `QGraphicsWidget::setLayout()`. As the widget is resized, the layout will automatically arrange the widget's children. `QGraphicsLayout` inherits `QGraphicsLayoutItem`, so, it can be managed by any layout, including its own subclasses.

## Writing a Custom Layout

You can use `QGraphicsLayout` as a base to write your own custom layout (e.g., a flowlayout), but it is more common to use one of its subclasses instead - `QGraphicsLinearLayout` or `QGraphicsGridLayout`. When creating a custom layout, the following functions must be reimplemented as a bare minimum:

Function | Description
--- | ---
`QGraphicsLayoutItem::setGeometry()` | Notifies you when the geometry of the layout is set. You can store the geometry in your own layout class in a reimplementation of this function.
`QGraphicsLayoutItem::sizeHint()` | Returns the layout's size hints.
`QGraphicsLayout::count()` | Returns the number of items in your layout.
`QGraphicsLayout::itemAt()` | Returns a pointer to an item in your layout.
`QGraphicsLayout::removeAt()` | Removes an item from your layout without destroying it.

For more details on how to implement each function, refer to the individual function documentation.

Each layout defines its own API for arranging widgets and layout items. For example, with a grid layout, you require a row and a column index with optional row and column spans, alignment, spacing, and more. A linear layout, however, requires a single row or column index to position its items. For a grid layout, the order of insertion does not affect the layout in any way, but for a linear layout, the order is essential. When writing your own layout subclass, you are free to choose the API that best suits your layout.

## Activating the Layout

When the layout's geometry changes, `QGraphicsLayout` immediately rearranges all of its managed items by calling `setGeometry()` on each item. This rearrangement is called activating the layout.

`QGraphicsLayout` updates its own geometry to match the `contentsRect()` of the `QGraphicsLayoutItem` it is managing. Thus, it will automatically rearrange all its items when the widget is resized. `QGraphicsLayout` caches the sizes of all its managed items to avoid calling `setGeometry()` too often.

Note: A `QGraphicsLayout` will have the same geometry as the `contentsRect()` of the widget (not the layout) it is assigned to.

### Activating the Layout Implicitly

The layout can be activated implicitly using one of two ways: by calling `activate()` or by calling `invalidate()`. Calling `activate()` activates the layout immediately. In contrast, calling `invalidate()` is delayed, as it posts a `LayoutRequest` event to the managed widget. Due to event compression, the `activate()` will only be called once after control has returned to the event loop. This is referred to as invalidating the layout. Invalidating the layout also invalidates any cached information. Also, the `invalidate()` function is a virtual function. So, you can invalidate your own cache in a subclass of `QGraphicsLayout` by reimplementing this function.

## Event Handling

`QGraphicsLayout` listens to events for the widget it manages through the virtual `widgetEvent()` event handler. When the layout is assigned to a widget, all events delivered to the widget are first processed by `widgetEvent()`. This allows the layout to be aware of any relevant state changes on the widget such as visibility changes or layout direction changes.

## Margin Handling

The margins of a `QGraphicsLayout` can be modified by reimplementing `setContentsMargins()` and `getContentsMargins()`.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Constructor Summary
`QGraphicsLayout()` Contructs a `QGraphicsLayout` object.
`QGraphicsLayout(QGraphicsLayoutItemInterface parent)` Contructs a `QGraphicsLayout` object.

Method Summary
`void` | `activate()` Activates the layout, causing all items in the layout to be immediately rearranged.
`QRectF` | `contentsRect()` Returns the contents rect in local coordinates.
`abstract int` | `count()` This pure virtual function must be reimplemented in a subclass of `QGraphicsLayout` to return the number of items in the layout.
`QSizeF` | `effectiveSizeHint(Qt.SizeHint which, QSizeF constraint)` Returns the effective size hint for this `QGraphicsLayoutItem`.
`static QGraphicsLayout` | `fromNativePointer(QNativePointer nativePointer)` This method returns the QGraphicsLayout instance pointed to by `nativePointer`.
`QRectF` | `geometry()` Returns the item's geometry (e.g., position and size) as a `QRectF`.
`QMarginsF` | `getContentsMargins()` This virtual function provides the `left`, `top`, `right` and `bottom` contents margins for this `QGraphicsLayoutItem`.
`void` | `invalidate()` Clears any cached geometry and size hint information in the layout, and posts a `LayoutRequest` event to the managed parent `QGraphicsLayoutItem`.
`boolean` | `isActivated()` Returns true if the layout is currently being activated; otherwise, returns false.
`boolean` | `isLayout()` Returns true if this `QGraphicsLayoutItem` is a layout (e.g., is inherited by an object that arranges other `QGraphicsLayoutItem` objects); otherwise returns false.
`abstract QGraphicsLayoutItemInterface` | `itemAt(int i)` This pure virtual function must be reimplemented in a subclass of `QGraphicsLayout` to return a pointer to the item at index `i`.
`double` | `maximumHeight()` Returns the maximum height.
`QSizeF` | `maximumSize()` Returns the maximum size.
`double` | `maximumWidth()` Returns the maximum width.
`double` | `minimumHeight()` Returns the minimum height.
`QSizeF` | `minimumSize()` Returns the minimum size.
`double` | `minimumWidth()` Returns the minimum width.
`QGraphicsLayoutItemInterface` | `parentLayoutItem()` Returns the parent of this `QGraphicsLayoutItem`, or 0 if there is no parent, or if the parent does not inherit from `QGraphicsLayoutItem` (`QGraphicsLayoutItem` is often used through multiple inheritance with `QObject`-derived classes).
`double` | `preferredHeight()` Returns the preferred height.
`QSizeF` | `preferredSize()` Returns the preferred size.
`double` | `preferredWidth()` Returns the preferred width.
`abstract void` | `removeAt(int index)` This pure virtual function must be reimplemented in a subclass of `QGraphicsLayout` to remove the item at index, `index`, without destroying it.
`void` | `setContentsMargins(double left, double top, double right, double bottom)` Sets the contents margins to `left`, `top`, `right` and `bottom`.
`void` | `setGeometry(QRectF rect)` This pure virtual function sets the geometry of the `QGraphicsLayoutItem` to `rect`, which is in parent coordinates (e.g., the top-left corner of `rect` is equivalent to the item's position in parent coordinates).
`void` | `setMaximumHeight(double height)` Sets the maximum height to `height`.
`void` | `setMaximumSize(double w, double h)` This convenience function is equivalent to calling setMaximumSize(`QSizeF`(`w`, `h`)).
`void` | `setMaximumSize(QSizeF size)` Sets the maximum size to `size`.
`void` | `setMaximumWidth(double width)` Sets the maximum width to `width`.
`void` | `setMinimumHeight(double height)` Sets the minimum height to `height`.
`void` | `setMinimumSize(double w, double h)` This convenience function is equivalent to calling setMinimumSize(`QSizeF`(`w`, `h`)).
`void` | `setMinimumSize(QSizeF size)` Sets the minimum size to `size`.
`void` | `setMinimumWidth(double width)` Sets the minimum width to `width`.
`void` | `setParentLayoutItem(QGraphicsLayoutItemInterface parent)` Sets the parent of this `QGraphicsLayoutItem` to `parent`.
`void` | `setPreferredHeight(double height)` Sets the preferred height to `height`.
`void` | `setPreferredSize(double w, double h)` This convenience function is equivalent to calling setPreferredSize(`QSizeF`(`w`, `h`)).
`void` | `setPreferredSize(QSizeF size)` Sets the preferred size to `size`.
`void` | `setPreferredWidth(double width)` Sets the preferred width to `width`.
`void` | `setSizePolicy(QSizePolicy.Policy hPolicy, QSizePolicy.Policy vPolicy, QSizePolicy.ControlType controlType)` This function is equivalent to calling setSizePolicy(`QSizePolicy`(`hPolicy`, `vPolicy`, `controlType`)).
`void` | `setSizePolicy(QSizePolicy policy)` Sets the size policy to `policy`.
`abstract QSizeF` | `sizeHint(Qt.SizeHint which, QSizeF constraint)` This pure virtual function returns the size hint for `which` of the `QGraphicsLayoutItem`, using the width or height of `constraint` to constrain the output.
`QSizePolicy` | `sizePolicy()` Returns the current size policy.
`void` | `updateGeometry()` This virtual function discards any cached size hint information.
`void` | `widgetEvent(QEvent e)` This virtual event handler receives all events for the managed widget.

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QGraphicsLayout

    public QGraphicsLayout()

  Contructs a `QGraphicsLayout` object.

  `parent` is passed to `QGraphicsLayoutItem`'s constructor and the `QGraphicsLayoutItem`'s isLayout argument is set to true.

### QGraphicsLayout

    public QGraphicsLayout(QGraphicsLayoutItemInterface parent)

  Contructs a `QGraphicsLayout` object.

  `parent` is passed to `QGraphicsLayoutItem`'s constructor and the `QGraphicsLayoutItem`'s isLayout argument is set to true.

Method Detail

### activate

    public final void activate()

  Activates the layout, causing all items in the layout to be immediately rearranged. This function is based on calling `count()` and `itemAt()`, and then calling `setGeometry()` on all items sequentially. When activated, the layout will adjust its geometry to its parent's `contentsRect()`. The parent will then invalidate any layout of its own.

  If called in sequence or recursively, e.g., by one of the arranged items in response to being resized, this function will do nothing.

  Note that the layout is free to use geometry caching to optimize this process. To forcefully invalidate any such cache, you can call `invalidate()` before calling `activate()`.

See also:
  `invalidate()`.

### contentsRect

    public final QRectF contentsRect()

  Returns the contents rect in local coordinates.

  The contents rect defines the subrectangle used by an associated layout when arranging subitems. This function is a convenience function that adjusts the item's `geometry()` by its contents margins. Note that `getContentsMargins()` is a virtual function that you can reimplement to return the item's contents margins.

See also:
  `getContentsMargins()`, and `geometry()`.

  Specified by:
    `contentsRect` in interface `QGraphicsLayoutItemInterface`

### effectiveSizeHint

    public final QSizeF effectiveSizeHint(Qt.SizeHint which,
                                          QSizeF constraint)

  Returns the effective size hint for this `QGraphicsLayoutItem`.

  `which` is the size hint in question. `constraint` is an optional argument that defines a special constrain when calculating the effective size hint. By default, `constraint` is `QSizeF`(-1, -1), which means there is no constraint to the size hint.

  If you want to specify the widget's size hint for a given width or height, you can provide the fixed dimension in `constraint`. This is useful for widgets that can grow only either vertically or horizontally, and need to set either their width or their height to a special value.

  For example, a text paragraph item fit into a column width of 200 may grow vertically. You can pass `QSizeF`(200, -1) as a constraint to get a suitable minimum, preferred and maximum height).

  You can adjust the effective size hint by reimplementing `sizeHint()` in a `QGraphicsLayoutItem` subclass, or by calling one of the following functions: `setMinimumSize()`, `setPreferredSize`, or `setMaximumSize()` (or a combination of both).

  This function caches each of the size hints and guarantees that `sizeHint()` will be called only once for each value of `which` - unless `constraint` is not specified and `updateGeometry()` has been called.

See also:
  `sizeHint()`.

  Specified by:
    `effectiveSizeHint` in interface `QGraphicsLayoutItemInterface`

### geometry

    public final QRectF geometry()

  Returns the item's geometry (e.g., position and size) as a `QRectF`. This function is equivalent to `QRectF`(`pos()`, size()).

See also:
  `setGeometry()`.

  Specified by:
    `geometry` in interface `QGraphicsLayoutItemInterface`

### isActivated

    public final boolean isActivated()

  Returns true if the layout is currently being activated; otherwise, returns false. If the layout is being activated, this means that it is currently in the process of rearranging its items (i.e., the `activate()` function has been called, and has not yet returned).

See also:
  `activate()`, and `invalidate()`.

### isLayout

    public final boolean isLayout()

  Returns true if this `QGraphicsLayoutItem` is a layout (e.g., is inherited by an object that arranges other `QGraphicsLayoutItem` objects); otherwise returns false.

See also:
  `QGraphicsLayout`.

  Specified by:
    `isLayout` in interface `QGraphicsLayoutItemInterface`

### maximumHeight

    public final double maximumHeight()

  Returns the maximum height.

See also:
  `setMaximumHeight()`, `setMaximumSize()`, and `maximumSize()`.

  Specified by:
    `maximumHeight` in interface `QGraphicsLayoutItemInterface`

### maximumSize

    public final QSizeF maximumSize()

  Returns the maximum size.

See also:
  `setMaximumSize()`, `minimumSize()`, `preferredSize()`, `Qt::MaximumSize` , and `sizeHint()`.

  Specified by:
    `maximumSize` in interface `QGraphicsLayoutItemInterface`

### maximumWidth

    public final double maximumWidth()

  Returns the maximum width.

See also:
  `setMaximumWidth()`, `setMaximumSize()`, and `maximumSize()`.

  Specified by:
    `maximumWidth` in interface `QGraphicsLayoutItemInterface`

### minimumHeight

    public final double minimumHeight()

  Returns the minimum height.

See also:
  `setMinimumHeight()`, `setMinimumSize()`, and `minimumSize()`.

  Specified by:
    `minimumHeight` in interface `QGraphicsLayoutItemInterface`

### minimumSize

    public final QSizeF minimumSize()

  Returns the minimum size.

See also:
  `setMinimumSize()`, `preferredSize()`, `maximumSize()`, `Qt::MinimumSize` , and `sizeHint()`.

  Specified by:
    `minimumSize` in interface `QGraphicsLayoutItemInterface`

### minimumWidth

    public final double minimumWidth()

  Returns the minimum width.

See also:
  `setMinimumWidth()`, `setMinimumSize()`, and `minimumSize()`.

  Specified by:
    `minimumWidth` in interface `QGraphicsLayoutItemInterface`

### parentLayoutItem

    public final QGraphicsLayoutItemInterface parentLayoutItem()

  Returns the parent of this `QGraphicsLayoutItem`, or 0 if there is no parent, or if the parent does not inherit from `QGraphicsLayoutItem` (`QGraphicsLayoutItem` is often used through multiple inheritance with `QObject`-derived classes).

See also:
  `setParentLayoutItem()`.

  Specified by:
    `parentLayoutItem` in interface `QGraphicsLayoutItemInterface`

### preferredHeight

    public final double preferredHeight()

  Returns the preferred height.

See also:
  `setPreferredHeight()`, `setPreferredSize()`, and `preferredSize()`.

  Specified by:
    `preferredHeight` in interface `QGraphicsLayoutItemInterface`

### preferredSize

    public final QSizeF preferredSize()

  Returns the preferred size.

See also:
  `setPreferredSize()`, `minimumSize()`, `maximumSize()`, `Qt::PreferredSize` , and `sizeHint()`.

  Specified by:
    `preferredSize` in interface `QGraphicsLayoutItemInterface`

### preferredWidth

    public final double preferredWidth()

  Returns the preferred width.

See also:
  `setPreferredWidth()`, `setPreferredSize()`, and `preferredSize()`.

  Specified by:
    `preferredWidth` in interface `QGraphicsLayoutItemInterface`

### setContentsMargins

    public final void setContentsMargins(double left,
                                         double top,
                                         double right,
                                         double bottom)

  Sets the contents margins to `left`, `top`, `right` and `bottom`. The default contents margins for toplevel layouts are style dependent (by querying the `pixelMetric` for `QStyle::PM_LayoutLeftMargin` , `QStyle::PM_LayoutTopMargin` , `QStyle::PM_LayoutRightMargin` and `QStyle::PM_LayoutBottomMargin` ).

  For sublayouts the default margins are 0.

  Changing the contents margins automatically invalidates the layout.

See also:
  `invalidate()`.

### setMaximumHeight

    public final void setMaximumHeight(double height)

  Sets the maximum height to `height`.

See also:
  `maximumHeight()`, `setMaximumSize()`, and `maximumSize()`.

  Specified by:
    `setMaximumHeight` in interface `QGraphicsLayoutItemInterface`

### setMaximumSize

    public final void setMaximumSize(QSizeF size)

  Sets the maximum size to `size`. This property overrides `sizeHint()` for `Qt::MaximumSize` and ensures that `effectiveSizeHint()` will never return a size larger than `size`. In order to unset the maximum size, use an invalid size.

See also:
  `maximumSize()`, `minimumSize()`, `preferredSize()`, `Qt::MaximumSize` , and `sizeHint()`.

  Specified by:
    `setMaximumSize` in interface `QGraphicsLayoutItemInterface`

### setMaximumSize

    public final void setMaximumSize(double w,
                                     double h)

  This convenience function is equivalent to calling setMaximumSize(`QSizeF`(`w`, `h`)).

See also:
  `maximumSize()`, `setMinimumSize()`, `setPreferredSize()`, and `sizeHint()`.

  Specified by:
    `setMaximumSize` in interface `QGraphicsLayoutItemInterface`

### setMaximumWidth

    public final void setMaximumWidth(double width)

  Sets the maximum width to `width`.

See also:
  `maximumWidth()`, `setMaximumSize()`, and `maximumSize()`.

  Specified by:
    `setMaximumWidth` in interface `QGraphicsLayoutItemInterface`

### setMinimumHeight

    public final void setMinimumHeight(double height)

  Sets the minimum height to `height`.

See also:
  `minimumHeight()`, `setMinimumSize()`, and `minimumSize()`.

  Specified by:
    `setMinimumHeight` in interface `QGraphicsLayoutItemInterface`

### setMinimumSize

    public final void setMinimumSize(QSizeF size)

  Sets the minimum size to `size`. This property overrides `sizeHint()` for `Qt::MinimumSize` and ensures that `effectiveSizeHint()` will never return a size smaller than `size`. In order to unset the minimum size, use an invalid size.

See also:
  `minimumSize()`, `maximumSize()`, `preferredSize()`, `Qt::MinimumSize` , `sizeHint()`, `setMinimumWidth()`, and `setMinimumHeight()`.

  Specified by:
    `setMinimumSize` in interface `QGraphicsLayoutItemInterface`

### setMinimumSize

    public final void setMinimumSize(double w,
                                     double h)

  This convenience function is equivalent to calling setMinimumSize(`QSizeF`(`w`, `h`)).

See also:
  `minimumSize()`, `setMaximumSize()`, `setPreferredSize()`, and `sizeHint()`.

  Specified by:
    `setMinimumSize` in interface `QGraphicsLayoutItemInterface`

### setMinimumWidth

    public final void setMinimumWidth(double width)

  Sets the minimum width to `width`.

See also:
  `minimumWidth()`, `setMinimumSize()`, and `minimumSize()`.

  Specified by:
    `setMinimumWidth` in interface `QGraphicsLayoutItemInterface`

### setParentLayoutItem

    public final void setParentLayoutItem(QGraphicsLayoutItemInterface parent)

  Sets the parent of this `QGraphicsLayoutItem` to `parent`.

See also:
  `parentLayoutItem()`.

  Specified by:
    `setParentLayoutItem` in interface `QGraphicsLayoutItemInterface`

### setPreferredHeight

    public final void setPreferredHeight(double height)

  Sets the preferred height to `height`.

See also:
  `preferredHeight()`, `preferredWidth()`, `setPreferredSize()`, and `preferredSize()`.

  Specified by:
    `setPreferredHeight` in interface `QGraphicsLayoutItemInterface`

### setPreferredSize

    public final void setPreferredSize(QSizeF size)

  Sets the preferred size to `size`. This property overrides `sizeHint()` for `Qt::PreferredSize` and provides the default value for `effectiveSizeHint()`. In order to unset the preferred size, use an invalid size.

See also:
  `preferredSize()`, `minimumSize()`, `maximumSize()`, `Qt::PreferredSize` , and `sizeHint()`.

  Specified by:
    `setPreferredSize` in interface `QGraphicsLayoutItemInterface`

### setPreferredSize

    public final void setPreferredSize(double w,
                                       double h)

  This convenience function is equivalent to calling setPreferredSize(`QSizeF`(`w`, `h`)).

See also:
  `preferredSize()`, `setMaximumSize()`, `setMinimumSize()`, and `sizeHint()`.

  Specified by:
    `setPreferredSize` in interface `QGraphicsLayoutItemInterface`

### setPreferredWidth

    public final void setPreferredWidth(double width)

  Sets the preferred width to `width`.

See also:
  `preferredWidth()`, `preferredHeight()`, `setPreferredSize()`, and `preferredSize()`.

  Specified by:
    `setPreferredWidth` in interface `QGraphicsLayoutItemInterface`

### setSizePolicy

    public final void setSizePolicy(QSizePolicy.Policy hPolicy,
                                    QSizePolicy.Policy vPolicy,
                                    QSizePolicy.ControlType controlType)

  This function is equivalent to calling setSizePolicy(`QSizePolicy`(`hPolicy`, `vPolicy`, `controlType`)).

See also:
  `sizePolicy()`, and `QWidget::sizePolicy()`.

  Specified by:
    `setSizePolicy` in interface `QGraphicsLayoutItemInterface`

### setSizePolicy

    public final void setSizePolicy(QSizePolicy policy)

  Sets the size policy to `policy`. The size policy describes how the item should grow horizontally and vertically when arranged in a layout.

  `QGraphicsLayoutItem`'s default size policy is (`QSizePolicy::Fixed` , `QSizePolicy::Fixed` , `QSizePolicy::DefaultType` ), but it is common for subclasses to change the default. For example, `QGraphicsWidget` defaults to (`QSizePolicy::Preferred` , `QSizePolicy::Preferred` , `QSizePolicy::DefaultType` ).

See also:
  `sizePolicy()`, and `QWidget::sizePolicy()`.

  Specified by:
    `setSizePolicy` in interface `QGraphicsLayoutItemInterface`

### sizePolicy

    public final QSizePolicy sizePolicy()

  Returns the current size policy.

See also:
  `setSizePolicy()`, and `QWidget::sizePolicy()`.

  Specified by:
    `sizePolicy` in interface `QGraphicsLayoutItemInterface`

### count

    public abstract int count()

  This pure virtual function must be reimplemented in a subclass of `QGraphicsLayout` to return the number of items in the layout.

  The subclass is free to decide how to store the items.

See also:
  `itemAt()`, and `removeAt()`.

### invalidate

    public void invalidate()

  Clears any cached geometry and size hint information in the layout, and posts a `LayoutRequest` event to the managed parent `QGraphicsLayoutItem`.

See also:
  `activate()`, and `setGeometry()`.

### itemAt

    public abstract QGraphicsLayoutItemInterface itemAt(int i)

  This pure virtual function must be reimplemented in a subclass of `QGraphicsLayout` to return a pointer to the item at index `i`. The reimplementation can assume that `i` is valid (i.e., it respects the value of `count()`).

  The subclass is free to decide how to store the items.

See also:
  `count()`, and `removeAt()`.

### removeAt

    public abstract void removeAt(int index)

  This pure virtual function must be reimplemented in a subclass of `QGraphicsLayout` to remove the item at index, `index`, without destroying it. The reimplementation can assume that `index` is valid (i.e., it respects the value of `count()`).

  The subclass is free to decide how to store the items.

See also:
  `itemAt()`, and `count()`.

### setGeometry

    public void setGeometry(QRectF rect)

  This pure virtual function sets the geometry of the `QGraphicsLayoutItem` to `rect`, which is in parent coordinates (e.g., the top-left corner of `rect` is equivalent to the item's position in parent coordinates).

  Reimplement this function in a subclass of `QGraphicsLayoutItem` to enable your item to receive geometry updates.

  If `rect` is outside of the bounds of `minimumSize` and `maximumSize`, it will be adjusted to its closest size so that it is within the legal bounds.

See also:
  `geometry()`.

  Specified by:
    `setGeometry` in interface `QGraphicsLayoutItemInterface`

### sizeHint

    public abstract QSizeF sizeHint(Qt.SizeHint which,
                                    QSizeF constraint)

  This pure virtual function returns the size hint for `which` of the `QGraphicsLayoutItem`, using the width or height of `constraint` to constrain the output.

  Reimplement this function in a subclass of `QGraphicsLayoutItem` to provide the necessary size hints for your items.

See also:
  `effectiveSizeHint()`.

  Specified by:
    `sizeHint` in interface `QGraphicsLayoutItemInterface`

### updateGeometry

    public void updateGeometry()

  This virtual function discards any cached size hint information. You should always call this function if you change the return value of the `sizeHint()` function. Subclasses must always call the base implementation when reimplementing this function.

See also:
  `effectiveSizeHint()`.

  Specified by:
    `updateGeometry` in interface `QGraphicsLayoutItemInterface`

### widgetEvent

    public void widgetEvent(QEvent e)

  This virtual event handler receives all events for the managed widget. `QGraphicsLayout` uses this event handler to listen for layout related events such as geometry changes, layout changes or layout direction changes.

  `e` is a pointer to the event.

  You can reimplement this event handler to track similar events for your own custom layout.

See also:
  `QGraphicsWidget::event()`, and `QGraphicsItem::sceneEvent()`.

### fromNativePointer

    public static QGraphicsLayout fromNativePointer(QNativePointer nativePointer)

  This method returns the QGraphicsLayout instance pointed to by `nativePointer`.

### getContentsMargins

    public final QMarginsF getContentsMargins()

  This virtual function provides the `left`, `top`, `right` and `bottom` contents margins for this `QGraphicsLayoutItem`. The default implementation assumes all contents margins are 0. The parameters point to values stored in qreals. If any of the pointers is 0, that value will not be updated.

See also:
  `QGraphicsWidget::setContentsMargins()`.

  Specified by:
    `getContentsMargins` in interface `QGraphicsLayoutItemInterface`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD