|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QSizeF
public class QSizeF
The QSizeF class defines the size of a two-dimensional object using floating 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 or equal to 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.
The QSizeF class also provides the toSize()
function returning a QSize
copy of this size, constructed by rounding the width and height to the nearest integers.
QSizeF objects can be streamed as well as compared.
QSize
, QPointF
, and QRectF
.
Nested Class Summary |
---|
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 | |
---|---|
QSizeF()
Constructs an invalid size. |
|
QSizeF(double w,
double h)
Constructs a size with the given width and height. |
|
QSizeF(QSize sz)
Constructs a size with floating point accuracy from the given size. |
Method Summary | |
---|---|
QSizeF |
add(QSizeF p)
Adds s to this QSizeF and returns the result. |
QSizeF |
boundedTo(QSizeF arg__1)
Returns a size holding the minimum width and height of this size and the given otherSize. |
QSizeF |
clone()
This method is reimplemented for internal reasons |
QSizeF |
divide(double d)
Divides this QSizeF by the divisor d and returns the result. |
QSizeF |
expandedTo(QSizeF arg__1)
Returns a size holding the maximum width and height of this size and the given otherSize. |
double |
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. |
QSizeF |
multiply(double d)
Multiplies this QSizeF by the factor d and return the result. |
void |
readFrom(QDataStream arg__1)
|
void |
scale(double w,
double h,
Qt.AspectRatioMode mode)
Scales the size to a rectangle with the given width and height, according to the specified mode. |
void |
scale(QSizeF s,
Qt.AspectRatioMode mode)
This is an overloaded member function, provided for convenience. |
void |
setHeight(double h)
Sets the height to the given height. |
void |
setWidth(double w)
Sets the width to the given width. |
QSizeF |
subtract(QSizeF p)
Subtracts s from this QSizeF and returns the result. |
QSize |
toSize()
Returns an integer based copy of this size. |
java.lang.String |
toString()
|
void |
transpose()
Swaps the width and height values. |
double |
width()
Returns the width. |
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 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 |
---|
public QSizeF()
isValid()
.
public QSizeF(QSize sz)
toSize()
.
public QSizeF(double w, double h)
Method Detail |
---|
public final QSizeF boundedTo(QSizeF arg__1)
expandedTo()
, and scale()
.
public final QSizeF expandedTo(QSizeF arg__1)
boundedTo()
, and scale()
.
public final double height()
width()
, and setHeight()
.
public final boolean isEmpty()
isNull()
, and isValid()
.
public final boolean isNull()
isValid()
, and isEmpty()
.
public final boolean isValid()
isNull()
, and isEmpty()
.
public final void writeTo(QDataStream arg__1)
public final void readFrom(QDataStream arg__1)
public final void scale(QSizeF s, Qt.AspectRatioMode mode)
Scales the size to a rectangle with the given size, according to the specified mode.
public final void scale(double w, double h, Qt.AspectRatioMode mode)
Qt::IgnoreAspectRatio
, the size is set to (width, height).Qt::KeepAspectRatio
, the current size is scaled to a rectangle as large as possible inside (width, height), preserving the aspect ratio.Qt::KeepAspectRatioByExpanding
, the current size is scaled to a rectangle as small as possible outside (width, height), preserving the aspect ratio.QSizeF t1 = new QSizeF(10, 12); t1.scale(60, 60, Qt.AspectRatioMode.IgnoreAspectRatio); // t1 is (60, 60) QSizeF t2 = new QSizeF(10, 12); t2.scale(60, 60, Qt.AspectRatioMode.KeepAspectRatio); // t2 is (50, 60) QSizeF t3 = new QSizeF(10, 12); t3.scale(60, 60, Qt.AspectRatioMode.KeepAspectRatioByExpanding); // t3 is (60, 72)
setWidth()
, and setHeight()
.
public final void setHeight(double h)
height()
, rheight(), and setWidth()
.
public final void setWidth(double w)
width()
, rwidth(), and setHeight()
.
public final QSize toSize()
Note that the coordinates in the returned size will be rounded to the nearest integer.
public final void transpose()
setWidth()
, and setHeight()
.
public final double width()
height()
, and setWidth()
.
public final QSizeF multiply(double d)
public final QSizeF divide(double d)
public final QSizeF add(QSizeF p)
public final QSizeF subtract(QSizeF p)
public java.lang.String toString()
toString
in class java.lang.Object
public QSizeF clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |