Qt Jambi Home

com.trolltech.qt.gui
Class QSpacerItem

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

public class QSpacerItem
extends QtJambiObject
implements QLayoutItemInterface

The QSpacerItem class provides blank space in a layout.

Normally, you don't need to use this class directly. Qt's built-in layout managers provide the following functions for manipulating empty space in layouts:

ClassFunctions
QHBoxLayoutaddSpacing(), addStretch(), insertSpacing(), insertStretch()
QGridLayoutsetRowMinimumHeight(), setRowStretch(), setColumnMinimumWidth(), setColumnStretch()

See Also:
QLayout, QWidgetItem, QLayoutItem::spacerItem

Nested Class Summary
 
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
QSpacerItem(int w, int h)
          Equivalent to QSpacerItem(w, h, QSizePolicy::Minimum, QSizePolicy::Minimum).
QSpacerItem(int w, int h, QSizePolicy.Policy hData)
          Equivalent to QSpacerItem(w, h, hData, QSizePolicy::Minimum).
QSpacerItem(int w, int h, QSizePolicy.Policy hData, QSizePolicy.Policy vData)
          Constructs a spacer item with preferred width w, preferred height h, horizontal size policy hData and vertical size policy vData.
 
Method Summary
 Qt.Alignment alignment()
          Returns the alignment of this item.
 void changeSize(int w, int h)
          Equivalent to changeSize(w, h, QSizePolicy::Minimum, QSizePolicy::Minimum).
 void changeSize(int w, int h, QSizePolicy.Policy hData)
          Equivalent to changeSize(w, h, hData, QSizePolicy::Minimum).
 void changeSize(int w, int h, QSizePolicy.Policy hData, QSizePolicy.Policy vData)
          Changes this spacer item to have preferred width w, preferred height h, horizontal size policy hData and vertical size policy vData.
 QSizePolicy.ControlTypes controlTypes()
          Returns the control type(s) for the layout item.
 Qt.Orientations expandingDirections()
          This function is reimplemented for internal reasons.
static QSpacerItem fromNativePointer(QNativePointer nativePointer)
          This function returns the QSpacerItem instance pointed to by nativePointer
 QRect geometry()
          This function is reimplemented for internal reasons.
 boolean hasHeightForWidth()
          Returns true if this layout's preferred height depends on its width; otherwise returns false.
 int heightForWidth(int arg__1)
          Returns the preferred height for this layout item, given the width arg__1.
 void invalidate()
          Invalidates any cached information in this layout item.
 boolean isEmpty()
          Returns true.
 QLayout layout()
          If this item is a QLayout, it is returned as a QLayout; otherwise 0 is returned.
 QSize maximumSize()
          This function is reimplemented for internal reasons.
 int minimumHeightForWidth(int arg__1)
          Returns the minimum height this widget needs for the given width, arg__1.
 QSize minimumSize()
          This function is reimplemented for internal reasons.
 void setAlignment(Qt.Alignment a)
          Sets the alignment of this item to a.
 void setGeometry(QRect arg__1)
          This function is reimplemented for internal reasons.
 QSize sizeHint()
          This function is reimplemented for internal reasons.
 QSpacerItem spacerItem()
          Returns a pointer to this object.
 QWidget widget()
          If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
 
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, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QSpacerItem

public QSpacerItem(int w,
                   int h,
                   QSizePolicy.Policy hData)

Equivalent to QSpacerItem(w, h, hData, QSizePolicy::Minimum).


QSpacerItem

public QSpacerItem(int w,
                   int h)

Equivalent to QSpacerItem(w, h, QSizePolicy::Minimum, QSizePolicy::Minimum).


QSpacerItem

public QSpacerItem(int w,
                   int h,
                   QSizePolicy.Policy hData,
                   QSizePolicy.Policy vData)

Constructs a spacer item with preferred width w, preferred height h, horizontal size policy hData and vertical size policy vData.

The default values provide a gap that is able to stretch if nothing else wants the space.

Method Detail

alignment

public final Qt.Alignment alignment()

Returns the alignment of this item.

Specified by:
alignment in interface QLayoutItemInterface
See Also:
setAlignment

changeSize

public final void changeSize(int w,
                             int h,
                             QSizePolicy.Policy hData)

Equivalent to changeSize(w, h, hData, QSizePolicy::Minimum).


changeSize

public final void changeSize(int w,
                             int h)

Equivalent to changeSize(w, h, QSizePolicy::Minimum, QSizePolicy::Minimum).


changeSize

public final void changeSize(int w,
                             int h,
                             QSizePolicy.Policy hData,
                             QSizePolicy.Policy vData)

Changes this spacer item to have preferred width w, preferred height h, horizontal size policy hData and vertical size policy vData.

The default values provide a gap that is able to stretch if nothing else wants the space.

Note that if changeSize is called after the spacer item has been added to a layout, it is necessary to invalidate the layout in order for the spacer item's new size to take effect.

See Also:
QSpacerItem::invalidate

controlTypes

public final QSizePolicy.ControlTypes controlTypes()

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.

Specified by:
controlTypes in interface QLayoutItemInterface
See Also:
QSizePolicy::controlType

setAlignment

public final void setAlignment(Qt.Alignment a)

Sets the alignment of this item to a.

Note: Item alignment is only supported by QLayoutItem subclasses where it would have a visual effect. Except for QSpacerItem, which provides blank space for layouts, all public Qt classes that inherit QLayoutItem support item alignment.

Specified by:
setAlignment in interface QLayoutItemInterface
See Also:
alignment

expandingDirections

public Qt.Orientations expandingDirections()

This function is reimplemented for internal reasons.

Specified by:
expandingDirections in interface QLayoutItemInterface

geometry

public QRect geometry()

This function is reimplemented for internal reasons.

Specified by:
geometry in interface QLayoutItemInterface
See Also:
setGeometry

hasHeightForWidth

public boolean hasHeightForWidth()

Returns true if this layout's preferred height depends on its width; otherwise returns false. The default implementation returns false.

Reimplement this function in layout managers that support height for width.

Specified by:
hasHeightForWidth in interface QLayoutItemInterface
See Also:
heightForWidth, QWidget::heightForWidth

heightForWidth

public int heightForWidth(int arg__1)

Returns the preferred height for this layout item, given the width arg__1.

The default implementation returns -1, indicating that the preferred height is independent of the width of the item. Using the function hasHeightForWidth will typically be much faster than calling this function and testing for -1.

Reimplement this function in layout managers that support height for width. A typical implementation will look like this:

    int MyLayout::heightForWidth(int w) const
    {
        if (cache_dirty || cached_width != w) {
            // not all C++ compilers support "mutable"
            MyLayout *that = (MyLayout*)this;
            int h = calculateHeightForWidth(w);
            that->cached_hfw = h;
            return h;
        }
        return cached_hfw;
    }

Caching is strongly recommended; without it layout will take exponential time.

Specified by:
heightForWidth in interface QLayoutItemInterface
See Also:
hasHeightForWidth

invalidate

public void invalidate()

Invalidates any cached information in this layout item.

Specified by:
invalidate in interface QLayoutItemInterface

isEmpty

public boolean isEmpty()

Returns true.

Specified by:
isEmpty in interface QLayoutItemInterface

layout

public QLayout layout()

If this item is a QLayout, it is returned as a QLayout; otherwise 0 is returned. This function provides type-safe casting.

Specified by:
layout in interface QLayoutItemInterface

maximumSize

public QSize maximumSize()

This function is reimplemented for internal reasons.

Specified by:
maximumSize in interface QLayoutItemInterface

minimumHeightForWidth

public int minimumHeightForWidth(int arg__1)

Returns the minimum height this widget needs for the given width, arg__1. The default implementation simply returns heightForWidth(arg__1).

Specified by:
minimumHeightForWidth in interface QLayoutItemInterface

minimumSize

public QSize minimumSize()

This function is reimplemented for internal reasons.

Specified by:
minimumSize in interface QLayoutItemInterface

setGeometry

public void setGeometry(QRect arg__1)

This function is reimplemented for internal reasons.

Specified by:
setGeometry in interface QLayoutItemInterface
See Also:
geometry

sizeHint

public QSize sizeHint()

This function is reimplemented for internal reasons.

Specified by:
sizeHint in interface QLayoutItemInterface

spacerItem

public QSpacerItem spacerItem()

Returns a pointer to this object.

Specified by:
spacerItem in interface QLayoutItemInterface

widget

public QWidget widget()

If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned. This function provides type-safe casting.

Specified by:
widget in interface QLayoutItemInterface

fromNativePointer

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

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

Qt Jambi Home