|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.gui.QSizePolicy
public class QSizePolicy
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.
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.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
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. |
static QSizePolicy |
fromNativePointer(QNativePointer 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)
|
void |
readFrom(QDataStream 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 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)
|
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 |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QSizePolicy()
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).
setHorizontalStretch()
, and setVerticalStretch()
.
public QSizePolicy(QSizePolicy.Policy horizontal, QSizePolicy.Policy vertical)
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).
setHorizontalStretch()
, and setVerticalStretch()
.
public QSizePolicy(QSizePolicy.Policy horizontal, QSizePolicy.Policy vertical, QSizePolicy.ControlType type)
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).
setHorizontalStretch()
, setVerticalStretch()
, and controlType()
.
Method Detail |
---|
public final QSizePolicy.ControlType controlType()
setControlType()
.
public final Qt.Orientations expandingDirections()
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.
horizontalPolicy()
, and verticalPolicy()
.
public final boolean hasHeightForWidth()
setHeightForWidth()
.
public final QSizePolicy.Policy horizontalPolicy()
setHorizontalPolicy()
, verticalPolicy()
, and horizontalStretch()
.
public final int horizontalStretch()
setHorizontalStretch()
, verticalStretch()
, and horizontalPolicy()
.
public final void writeTo(QDataStream arg__1)
public final void readFrom(QDataStream arg__1)
public final void setControlType(QSizePolicy.ControlType 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.
controlType()
, and QStyle::layoutSpacing()
.
public final void setHeightForWidth(boolean b)
hasHeightForWidth()
.
public final void setHorizontalPolicy(QSizePolicy.Policy d)
horizontalPolicy()
, setVerticalPolicy()
, and setHorizontalStretch()
.
public final void setHorizontalStretch(byte stretchFactor)
horizontalStretch()
, setVerticalStretch()
, and setHorizontalPolicy()
.
public final void setVerticalPolicy(QSizePolicy.Policy d)
verticalPolicy()
, setHorizontalPolicy()
, and setVerticalStretch()
.
public final void setVerticalStretch(byte stretchFactor)
verticalStretch()
, setHorizontalStretch()
, and setVerticalPolicy()
.
public final void transpose()
public final QSizePolicy.Policy verticalPolicy()
setVerticalPolicy()
, horizontalPolicy()
, and verticalStretch()
.
public final int verticalStretch()
setVerticalStretch()
, horizontalStretch()
, and verticalPolicy()
.
public static QSizePolicy fromNativePointer(QNativePointer nativePointer)
public static QNativePointer nativePointerArray(QSizePolicy[] array)
public QSizePolicy clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |