Qt Jambi Home

com.trolltech.qt.gui
Class QSizePolicy

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.gui.QSizePolicy
All Implemented Interfaces:
QtJambiInterface

public class QSizePolicy
extends QtJambiObject

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, 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 QFlag class provides flags for the int enum.
static class QSizePolicy.Policy
          This enum describes the various per-dimension sizing types used when constructing a QSizePolicy.
static class QSizePolicy.PolicyFlag
          These flags are combined together to form the various Policy values:
ConstantValueDescription GrowFlag1The widget can grow beyond its size hint if necessary.
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
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.ControlType controlType()
          Returns the control type associated with the widget for which this size policy applies.
 boolean equals(java.lang.Object other)
          
 Qt.Orientations expandingDirections()
          Returns whether a widget can make use of more space than the QWidget::sizeHint() function indicates.
static QSizePolicy fromNativePointer(QNativePointer nativePointer)
          This function returns the QSizePolicy instance pointed to by nativePointer
 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.
static QNativePointer nativePointerArray(QSizePolicy[] array)
          This function returns a QNativePointer that is pointing to the specified QSizePolicy array.
 void readFrom(QDataStream arg__1)
          Reads a QSizePolicy from arg__1.
 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 b.
 void setHorizontalPolicy(QSizePolicy.Policy d)
          Sets the horizontal component to the given d.
 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 d.
 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 to arg__1.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, 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

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, controlType

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, 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, setVerticalStretch
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, 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, horizontalStretch

horizontalStretch

public final int horizontalStretch()

Returns the horizontal stretch factor of the size policy.

See Also:
setHorizontalStretch, verticalStretch, horizontalPolicy

writeTo

public final void writeTo(QDataStream arg__1)
Writes thisQSizePolicy to arg__1.


readFrom

public final void readFrom(QDataStream arg__1)
Reads a QSizePolicy from arg__1.


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, QStyle::layoutSpacing

setHeightForWidth

public final void setHeightForWidth(boolean b)

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

See Also:
hasHeightForWidth

setHorizontalPolicy

public final void setHorizontalPolicy(QSizePolicy.Policy d)

Sets the horizontal component to the given d.

See Also:
horizontalPolicy, setVerticalPolicy, 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, setHorizontalPolicy

setVerticalPolicy

public final void setVerticalPolicy(QSizePolicy.Policy d)

Sets the vertical component to the given d.

See Also:
verticalPolicy, setHorizontalPolicy, 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, 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, verticalStretch

verticalStretch

public final int verticalStretch()

Returns the vertical stretch factor of the size policy.

See Also:
setVerticalStretch, horizontalStretch, verticalPolicy

fromNativePointer

public static QSizePolicy fromNativePointer(QNativePointer nativePointer)
This function returns the QSizePolicy instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

public static QNativePointer nativePointerArray(QSizePolicy[] array)
This function returns a QNativePointer that is pointing to the specified QSizePolicy array.

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

equals

public boolean equals(java.lang.Object other)

Overrides:
equals in class java.lang.Object

Qt Jambi Home