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 QSizePolicy

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.gui.QSizePolicy

All Implemented Interfaces:
  QtJambiInterface, java.lang.Cloneable

    public class QSizePolicy

extends QtJambiObject
implements java.lang.Cloneable

The `QSizePolicy` class is a layout attribute describing horizontal and vertical resizing policy. The size policy of a widget is an expression of its willingness to be resized in various ways, and affects how the widget is treated by the layout engine. Widgets that reimplement `QWidget::sizePolicy()` return a `QSizePolicy` that describes the horizontal and vertical resizing policy they prefer when being laid out.

`QSizePolicy` contains two independent `QSizePolicy::Policy` values and two stretch factors; one describes the widgets's horizontal size policy, and the other describes its vertical size policy. It also contains a flag to indicate whether the height and width of its preferred size are related.

The horizontal and vertical policies can be set in the constructor, and altered using the `setHorizontalPolicy()` and `setVerticalPolicy()` functions. The stretch factors can be set using the `setHorizontalStretch()` and `setVerticalStretch()` functions. The flag indicating whether the widget's `sizeHint()` is width-dependent (such as a menu bar or a word-wrapping label) can be set using the `setHeightForWidth()` function.

The current size policies and stretch factors be retrieved using the `horizontalPolicy()`, `verticalPolicy()`, `horizontalStretch()` and `verticalStretch()` functions. Alternatively, use the `transpose()` function to swap the horizontal and vertical policies and stretches. The `hasHeightForWidth()` function returns the current status of the flag indicating the size hint dependencies.

Use the `expandingDirections()` function to determine whether the associated widget can make use of more space than its `sizeHint()` function indicates, as well as find out in which directions it can expand.

Finally, the `QSizePolicy` class provides operators comparing this size policy to a given policy, as well as a `QVariant` operator storing this `QSizePolicy` as a `QVariant` object.

See also:
  `QSize`, `QWidget::sizeHint()`, `QWidget::sizePolicy()`, and `QLayoutItem::sizeHint()`.

Nested Class Summary
`static class` | `QSizePolicy.ControlType` This enum specifies the different types of widgets in terms of layout interaction.
`static class` | `QSizePolicy.ControlTypes` This is a flags class for com.trolltech.qt.gui.QSizePolicy.ControlType
`static class` | `QSizePolicy.Policy`
`static class` | `QSizePolicy.PolicyFlag` These flags are combined together to form the various `Policy` values:

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

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QSizePolicy()` Constructs a `QSizePolicy` object with `Fixed` as its horizontal and vertical policies.
`QSizePolicy(QSizePolicy.Policy horizontal, QSizePolicy.Policy vertical)` Constructs a `QSizePolicy` object with the given `horizontal` and `vertical` policies, and `DefaultType` as the control type.
`QSizePolicy(QSizePolicy.Policy horizontal, QSizePolicy.Policy vertical, QSizePolicy.ControlType type)` Constructs a `QSizePolicy` object with the given `horizontal` and `vertical` policies, and the specified control `type`.

Method Summary
`QSizePolicy` | `clone()` This method is reimplemented for internal reasons
`QSizePolicy.ControlType` | `controlType()` Returns the control type associated with the widget for which this size policy applies.
`Qt.Orientations` | `expandingDirections()` Returns whether a widget can make use of more space than the `QWidget.:sizeHint()` function indicates.
`boolean` | `hasHeightForWidth()` Returns true if the widget's preferred height depends on its width; otherwise returns false.
`QSizePolicy.Policy` | `horizontalPolicy()` Returns the horizontal component of the size policy.
`int` | `horizontalStretch()` Returns the horizontal stretch factor of the size policy.
`void` | `readFrom(QDataStream arg__1)` Reads a QSizePolicy
`void` | `setControlType(QSizePolicy.ControlType type)` Sets the control type associated with the widget for which this size policy applies to `type`.
`void` | `setHeightForWidth(boolean b)` Sets the flag determining whether the widget's preferred height depends on its width, to `dependent`.
`void` | `setHorizontalPolicy(QSizePolicy.Policy d)` Sets the horizontal component to the given `policy`.
`void` | `setHorizontalStretch(byte stretchFactor)` Sets the horizontal stretch factor of the size policy to the given `stretchFactor`.
`void` | `setVerticalPolicy(QSizePolicy.Policy d)` Sets the vertical component to the given `policy`.
`void` | `setVerticalStretch(byte stretchFactor)` Sets the vertical stretch factor of the size policy to the given `stretchFactor`.
`void` | `transpose()` Swaps the horizontal and vertical policies and stretches.
`QSizePolicy.Policy` | `verticalPolicy()` Returns the vertical component of the size policy.
`int` | `verticalStretch()` Returns the vertical stretch factor of the size policy.
`void` | `writeTo(QDataStream arg__1)` Writes thisQSizePolicy

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 com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

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

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

Constructor Detail

### QSizePolicy

    public QSizePolicy()

  Constructs a `QSizePolicy` object with `Fixed` as its horizontal and vertical policies.

  The policies can be altered using the `setHorizontalPolicy()` and `setVerticalPolicy()` functions. Use the `setHeightForWidth()` function if the preferred height of the widget is dependent on the width of the widget (for example, a `QLabel` with line wrapping).

See also:
  `setHorizontalStretch()`, and `setVerticalStretch()`.

### QSizePolicy

    public QSizePolicy(QSizePolicy.Policy horizontal,
                       QSizePolicy.Policy vertical)

  Constructs a `QSizePolicy` object with the given `horizontal` and `vertical` policies, and `DefaultType` as the control type.

  Use `setHeightForWidth()` if the preferred height of the widget is dependent on the width of the widget (for example, a `QLabel` with line wrapping).

See also:
  `setHorizontalStretch()`, and `setVerticalStretch()`.

### QSizePolicy

    public QSizePolicy(QSizePolicy.Policy horizontal,
                       QSizePolicy.Policy vertical,
                       QSizePolicy.ControlType type)

  Constructs a `QSizePolicy` object with the given `horizontal` and `vertical` policies, and the specified control `type`.

  Use `setHeightForWidth()` if the preferred height of the widget is dependent on the width of the widget (for example, a `QLabel` with line wrapping).

See also:
  `setHorizontalStretch()`, `setVerticalStretch()`, and `controlType()`.

Method Detail

### controlType

    public final QSizePolicy.ControlType controlType()

  Returns the control type associated with the widget for which this size policy applies.

See also:
  `setControlType()`.

### expandingDirections

    public final Qt.Orientations expandingDirections()

  Returns whether a widget can make use of more space than the `QWidget.:sizeHint()` function indicates.

  A value of `Qt::Horizontal` or `Qt::Vertical` means that the widget can grow horizontally or vertically (i.e., the horizontal or vertical policy is `Expanding` or `MinimumExpanding` ), whereas `Qt::Horizontal` | `Qt::Vertical` means that it can grow in both dimensions.

See also:
  `horizontalPolicy()`, and `verticalPolicy()`.

### hasHeightForWidth

    public final boolean hasHeightForWidth()

  Returns true if the widget's preferred height depends on its width; otherwise returns false.

See also:
  `setHeightForWidth()`.

### horizontalPolicy

    public final QSizePolicy.Policy horizontalPolicy()

  Returns the horizontal component of the size policy.

See also:
  `setHorizontalPolicy()`, `verticalPolicy()`, and `horizontalStretch()`.

### horizontalStretch

    public final int horizontalStretch()

  Returns the horizontal stretch factor of the size policy.

See also:
  `setHorizontalStretch()`, `verticalStretch()`, and `horizontalPolicy()`.

### writeTo

    public final void writeTo(QDataStream arg__1)

  Writes thisQSizePolicy

### readFrom

    public final void readFrom(QDataStream arg__1)

  Reads a QSizePolicy

### setControlType

    public final void setControlType(QSizePolicy.ControlType type)

  Sets the control type associated with the widget for which this size policy applies to `type`.

  The control type specifies the type of the widget for which this size policy applies. It is used by some styles, notably QMacStyle, to insert proper spacing between widgets. For example, the Mac OS X Aqua guidelines specify that push buttons should be separated by 12 pixels, whereas vertically stacked radio buttons only require 6 pixels.

See also:
  `controlType()`, and `QStyle::layoutSpacing()`.

### setHeightForWidth

    public final void setHeightForWidth(boolean b)

  Sets the flag determining whether the widget's preferred height depends on its width, to `dependent`.

See also:
  `hasHeightForWidth()`.

### setHorizontalPolicy

    public final void setHorizontalPolicy(QSizePolicy.Policy d)

  Sets the horizontal component to the given `policy`.

See also:
  `horizontalPolicy()`, `setVerticalPolicy()`, and `setHorizontalStretch()`.

### setHorizontalStretch

    public final void setHorizontalStretch(byte stretchFactor)

  Sets the horizontal stretch factor of the size policy to the given `stretchFactor`.

See also:
  `horizontalStretch()`, `setVerticalStretch()`, and `setHorizontalPolicy()`.

### setVerticalPolicy

    public final void setVerticalPolicy(QSizePolicy.Policy d)

  Sets the vertical component to the given `policy`.

See also:
  `verticalPolicy()`, `setHorizontalPolicy()`, and `setVerticalStretch()`.

### setVerticalStretch

    public final void setVerticalStretch(byte stretchFactor)

  Sets the vertical stretch factor of the size policy to the given `stretchFactor`.

See also:
  `verticalStretch()`, `setHorizontalStretch()`, and `setVerticalPolicy()`.

### transpose

    public final void transpose()

  Swaps the horizontal and vertical policies and stretches.

### verticalPolicy

    public final QSizePolicy.Policy verticalPolicy()

  Returns the vertical component of the size policy.

See also:
  `setVerticalPolicy()`, `horizontalPolicy()`, and `verticalStretch()`.

### verticalStretch

    public final int verticalStretch()

  Returns the vertical stretch factor of the size policy.

See also:
  `setVerticalStretch()`, `horizontalStretch()`, and `verticalPolicy()`.

### clone

    public QSizePolicy clone()

  This method is reimplemented for internal reasons

  Overrides:
    `clone` in class `java.lang.Object`

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