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.core
Class QSize

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QSize

All Implemented Interfaces:
  QtJambiInterface, java.lang.Cloneable

    public class QSize

extends QtJambiObject
implements java.lang.Cloneable

The QSize class defines the size of a two-dimensional object using integer point precision. A size is specified by a `width()` and a `height()`. It can be set in the constructor and changed using the `setWidth()`, `setHeight()`, or `scale()` functions, or using arithmetic operators. A size can also be manipulated directly by retrieving references to the width and height using the rwidth() and rheight() functions. Finally, the width and height can be swapped using the `transpose()` function.

The `isValid()` function determines if a size is valid (a valid size has both width and height greater than zero). The `isEmpty()` function returns true if either of the width and height is less than, or equal to, zero, while the `isNull()` function returns true only if both the width and the height is zero.

Use the `expandedTo()` function to retrieve a size which holds the maximum height and width of this size and a given size. Similarly, the `boundedTo()` function returns a size which holds the minimum height and width of this size and a given size.

QSize objects can be streamed as well as compared.

See also:
  `QSizeF`, `QPoint`, and `QRect`.

Nested Class Summary

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
`QSize()` Constructs a size with an invalid width and height (i.
`QSize(int w, int h)` Constructs a size with the given `width` and `height`.

Method Summary
`QSize` | `add(QSize p)` Adds `s` to this QSize and returns the result.
`QSize` | `boundedTo(QSize arg__1)` Returns a size holding the minimum width and height of this size and the given `otherSize`.
`QSize` | `clone()` This method is reimplemented for internal reasons
`QSize` | `divide(double d)` Divides this QSize by divisor `d` and returns the result.
`QSize` | `expandedTo(QSize arg__1)` Returns a size holding the maximum width and height of this size and the given `otherSize`.
`int` | `height()` Returns the height.
`boolean` | `isEmpty()` Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
`boolean` | `isNull()` Returns true if both the width and height is 0; otherwise returns false.
`boolean` | `isValid()` Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
`QSize` | `multiply(double d)` Multiplies this QSize by factor `d` and returns the result.
`void` | `readFrom(QDataStream arg__1)` Reads a QSize
`void` | `scale(int w, int h, Qt.AspectRatioMode mode)` Scales the size to a rectangle with the given `width` and `height`, according to the specified `mode`.
`void` | `scale(QSize s, Qt.AspectRatioMode mode)` Scales the size to a rectangle with the given `size`, according to the specified `mode`.
`void` | `setHeight(int h)` Sets the height to the given `height`.
`void` | `setWidth(int w)` Sets the width to the given `width`.
`QSize` | `subtract(QSize p)` Subtracts `s` from this QSize and returns the result.
`java.lang.String` | `toString()` Returns a string representation of the `this QSize`.
`void` | `transpose()` Swaps the width and height values.
`int` | `width()` Returns the width.
`void` | `writeTo(QDataStream arg__1)` Writes thisQSize

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, wait, wait, wait`

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

Constructor Detail

### QSize

    public QSize()

  Constructs a size with an invalid width and height (i. ., `isValid()` returns false).

See also:
  `isValid()`.

### QSize

    public QSize(int w,
                 int h)

  Constructs a size with the given `width` and `height`.

See also:
  `setWidth()`, and `setHeight()`.

Method Detail

### boundedTo

    public final QSize boundedTo(QSize arg__1)

  Returns a size holding the minimum width and height of this size and the given `otherSize`.

See also:
  `expandedTo()`, and `scale()`.

### expandedTo

    public final QSize expandedTo(QSize arg__1)

  Returns a size holding the maximum width and height of this size and the given `otherSize`.

See also:
  `boundedTo()`, and `scale()`.

### height

    public final int height()

  Returns the height.

See also:
  `width()`, and `setHeight()`.

### isEmpty

    public final boolean isEmpty()

  Returns true if either of the width and height is less than or equal to 0; otherwise returns false.

See also:
  `isNull()`, and `isValid()`.

### isNull

    public final boolean isNull()

  Returns true if both the width and height is 0; otherwise returns false.

See also:
  `isValid()`, and `isEmpty()`.

### isValid

    public final boolean isValid()

  Returns true if both the width and height is equal to or greater than 0; otherwise returns false.

See also:
  `isNull()`, and `isEmpty()`.

### writeTo

    public final void writeTo(QDataStream arg__1)

  Writes thisQSize

### readFrom

    public final void readFrom(QDataStream arg__1)

  Reads a QSize

### scale

    public final void scale(QSize s,
                            Qt.AspectRatioMode mode)

  Scales the size to a rectangle with the given `size`, according to the specified `mode`.

### scale

    public final void scale(int w,
                            int h,
                            Qt.AspectRatioMode mode)

  Scales the size to a rectangle with the given `width` and `height`, according to the specified `mode`.
  - If `mode` is `Qt::IgnoreAspectRatio` , the size is set to (`width`, `height`).
  - If `mode` is `Qt::KeepAspectRatio` , the current size is scaled to a rectangle as large as possible inside (`width`, `height`), preserving the aspect ratio.
  - If `mode` is `Qt::KeepAspectRatioByExpanding` , the current size is scaled to a rectangle as small as possible outside (`width`, `height`), preserving the aspect ratio.
  Example:

              QSize t1 = new QSize(10, 12);
              t1.scale(60, 60, Qt.AspectRatioMode.IgnoreAspectRatio);
              // t1 is (60, 60)

              QSize t2 = new QSize(10, 12);
              t2.scale(60, 60, Qt.AspectRatioMode.KeepAspectRatio);
              // t2 is (50, 60)

              QSize t3 = new QSize(10, 12);
              t3.scale(60, 60, Qt.AspectRatioMode.KeepAspectRatioByExpanding);
              // t3 is (60, 72)

See also:
  `setWidth()`, and `setHeight()`.

### setHeight

    public final void setHeight(int h)

  Sets the height to the given `height`.

See also:
  rheight(), `height()`, and `setWidth()`.

### setWidth

    public final void setWidth(int w)

  Sets the width to the given `width`.

See also:
  rwidth(), `width()`, and `setHeight()`.

### transpose

    public final void transpose()

  Swaps the width and height values.

See also:
  `setWidth()`, and `setHeight()`.

### width

    public final int width()

  Returns the width.

See also:
  `height()`, and `setWidth()`.

### multiply

    public final QSize multiply(double d)

  Multiplies this QSize by factor `d` and returns the result.

### divide

    public final QSize divide(double d)

  Divides this QSize by divisor `d` and returns the result.

### add

    public final QSize add(QSize p)

  Adds `s` to this QSize and returns the result.

### subtract

    public final QSize subtract(QSize p)

  Subtracts `s` from this QSize and returns the result.

### toString

    public java.lang.String toString()

  Returns a string representation of the `this QSize`.

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

### clone

    public QSize 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