Qt 4.8
|
The QSizeF class defines the size of a two-dimensional object using floating point precision. More...
#include <qsize.h>
Public Functions | |
QSizeF | boundedTo (const QSizeF &) const |
Returns a size holding the minimum width and height of this size and the given otherSize. More... | |
QSizeF | expandedTo (const QSizeF &) const |
Returns a size holding the maximum width and height of this size and the given otherSize. More... | |
qreal | height () const |
Returns the height. More... | |
bool | isEmpty () const |
Returns true if either of the width and height is less than or equal to 0; otherwise returns false. More... | |
bool | isNull () const |
Returns true if both the width and height are +0. More... | |
bool | isValid () const |
Returns true if both the width and height is equal to or greater than 0; otherwise returns false. More... | |
QSizeF & | operator*= (qreal c) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Multiplies both the width and height by the given factor and returns a reference to the size. More... | |
QSizeF & | operator+= (const QSizeF &) |
Adds the given size to this size and returns a reference to this size. More... | |
QSizeF & | operator-= (const QSizeF &) |
Subtracts the given size from this size and returns a reference to this size. More... | |
QSizeF & | operator/= (qreal c) |
Divides both the width and height by the given divisor and returns a reference to the size. More... | |
QSizeF () | |
Constructs an invalid size. More... | |
QSizeF (const QSize &sz) | |
Constructs a size with floating point accuracy from the given size. More... | |
QSizeF (qreal w, qreal h) | |
Constructs a size with the given width and height. More... | |
qreal & | rheight () |
Returns a reference to the height. More... | |
qreal & | rwidth () |
Returns a reference to the width. More... | |
void | scale (qreal w, qreal h, Qt::AspectRatioMode mode) |
Scales the size to a rectangle with the given width and height, according to the specified mode. More... | |
void | scale (const QSizeF &s, Qt::AspectRatioMode mode) |
Scales the size to a rectangle with the given size, according to the specified mode. More... | |
void | setHeight (qreal h) |
Sets the height to the given height. More... | |
void | setWidth (qreal w) |
Sets the width to the given width. More... | |
QSize | toSize () const |
Returns an integer based copy of this size. More... | |
void | transpose () |
Swaps the width and height values. More... | |
qreal | width () const |
Returns the width. More... | |
Properties | |
qreal | ht |
qreal | wd |
Friends | |
bool | operator!= (const QSizeF &, const QSizeF &) |
Returns true if s1 and s2 are different; otherwise returns false. More... | |
const QSizeF | operator* (const QSizeF &, qreal) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
const QSizeF | operator* (qreal, const QSizeF &) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
const QSizeF | operator+ (const QSizeF &, const QSizeF &) |
Returns the sum of s1 and s2; each component is added separately. More... | |
const QSizeF | operator- (const QSizeF &, const QSizeF &) |
Returns s2 subtracted from s1; each component is subtracted separately. More... | |
const QSizeF | operator/ (const QSizeF &, qreal) |
Divides the given size by the given divisor and returns the result. More... | |
bool | operator== (const QSizeF &, const QSizeF &) |
Returns true if s1 and s2 are equal; otherwise returns false. More... | |
Related Functions | |
(Note that these are not member functions.) | |
QDataStream & | operator<< (QDataStream &stream, const QSizeF &size) |
Writes the given size to the given stream and returns a reference to the stream. More... | |
QDataStream & | operator>> (QDataStream &stream, QSizeF &size) |
Reads a size from the given stream into the given size and returns a reference to the stream. More... | |
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.
|
inline |
Constructs an invalid size.
Definition at line 264 of file qsize.h.
Referenced by boundedTo(), expandedTo(), operator*(), operator+(), operator-(), operator/(), and scale().
|
inline |
Returns a size holding the minimum width and height of this size and the given otherSize.
Definition at line 350 of file qsize.h.
Referenced by QGridLayoutItem::geometryWithin(), QGraphicsLayoutItem::setGeometry(), QGraphicsWidget::setGeometry(), and QGraphicsView::sizeHint().
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition at line 345 of file qsize.h.
Referenced by QGraphicsLayoutItem::setGeometry(), and QGraphicsWidget::setGeometry().
|
inline |
Returns the height.
Definition at line 287 of file qsize.h.
Referenced by _q_boundGeometryToSizeConstraints(), QPageSetupWidget::_q_paperSizeChanged(), QGraphicsTextItemPrivate::_q_updateBoundingRect(), QDeclarativeLoaderPrivate::_q_updateSize(), QTextDocument::adjustSize(), QDeclarativePaintedItem::boundingRect(), boundSize(), QGridLayoutItem::box(), QBlitterPaintEnginePrivate::clipAndDrawPixmap(), closestAcceptableSize(), combineSize(), QGraphicsTextItemPrivate::controlOffset(), QDeclarativeRow::doPositioning(), QDeclarativeFlow::doPositioning(), QSvgText::draw(), QTextDocumentLayoutPrivate::drawBorder(), QItemDelegate::drawDisplay(), QTextDocumentLayoutPrivate::drawFrame(), QTextDocumentLayoutPrivate::drawListItem(), QTextDocumentLayout::dynamicPageCount(), QGridLayoutItem::effectiveMaxSize(), QGraphicsLayoutItemPrivate::effectiveSizeHints(), QGridLayoutEngine::ensureGeometries(), epsilonCompare(), expandSize(), QFixedSize::fromSizeF(), QDeclarativeCompiler::genLiteralAssignment(), QGridLayoutItem::geometryWithin(), QTextDocumentLayoutPrivate::layoutCell(), QTextDocumentLayoutPrivate::layoutFlow(), QTextDocumentLayoutPrivate::layoutFrame(), QTextDocumentLayoutPrivate::layoutTable(), QGraphicsLayoutItem::maximumHeight(), QGraphicsLayoutItem::minimumHeight(), minimumHeightForWidth(), operator<<(), QPdfBaseEnginePrivate::pageRect(), QtopiaPrintEngine::paperRect(), QPdfBaseEnginePrivate::paperRect(), QPdf::paperSize(), QPrinter::paperSize(), QGraphicsLayoutItem::preferredHeight(), QDeclarativeBasePositioner::prePositioning(), qDrawRoundedCorners(), QRectF::QRectF(), qSizeFTopaperSize(), QSvgIOHandler::read(), QTextDocumentLayout::resizeInlineObject(), QAbstractTextDocumentLayout::resizeInlineObject(), QDeclarativeViewPrivate::rootObjectSize(), QGraphicsWidget::setGeometry(), QGraphicsAnchorLayoutPrivate::setItemsGeometries(), QPrinter::setPaperSize(), QPageSetupWidget::setPrinter(), QWin32PrintEngine::setProperty(), QGraphicsLayoutItemPrivate::setSize(), QDeclarativeItem::setSize(), QRectF::setSize(), QGLShaderProgram::setUniformValue(), QDeclarativeSizeFValueType::setValue(), sizeForOrientation(), QLabelPrivate::sizeForWidth(), QGridLayoutEngine::sizeHint(), QGraphicsTextItemPrivate::textControl(), QItemDelegate::textRectangle(), QTest::toString(), and QPageSetupWidget::unitChanged().
|
inline |
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
Definition at line 278 of file qsize.h.
Referenced by QBlitterPaintEngine::fillRect(), and qDrawRoundedCorners().
|
inline |
Returns true if both the width and height are +0.
0; otherwise returns false.
Definition at line 275 of file qsize.h.
Referenced by QTextEdit::resizeEvent().
|
inline |
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
Definition at line 281 of file qsize.h.
Referenced by QGraphicsWidget::adjustSize(), QGridLayoutItem::effectiveMaxSize(), QGraphicsLayoutItem::effectiveSizeHint(), and QDeclarativeViewPrivate::updateSize().
|
inline |
Returns a reference to the height.
Using a reference makes it possible to manipulate the height directly. For example:
Definition at line 302 of file qsize.h.
Referenced by QGraphicsLayoutItemPrivate::effectiveSizeHints(), QPainterPath::operator==(), QtopiaPrintEngine::paperRect(), and QGraphicsLayoutItemPrivate::setSizeComponent().
|
inline |
Returns a reference to the width.
Using a reference makes it possible to manipulate the width directly. For example:
Definition at line 299 of file qsize.h.
Referenced by QGraphicsLayoutItemPrivate::effectiveSizeHints(), QPainterPath::operator==(), and QtopiaPrintEngine::paperRect().
|
inline |
Scales the size to a rectangle with the given width and height, according to the specified mode.
Example:
Definition at line 296 of file qsize.h.
Referenced by QPagePreview::paintEvent().
void QSizeF::scale | ( | const QSizeF & | size, |
Qt::AspectRatioMode | mode | ||
) |
Scales the size to a rectangle with the given size, according to the specified mode.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 726 of file qsize.cpp.
|
inline |
Sets the height to the given height.
Definition at line 293 of file qsize.h.
Referenced by QPageSetupWidget::_q_paperSizeChanged(), QDeclarativeLoaderPrivate::_q_updateSize(), boundSize(), combineSize(), QDeclarativeColumn::doPositioning(), QDeclarativeRow::doPositioning(), QDeclarativeGrid::doPositioning(), QDeclarativeFlow::doPositioning(), QTextDocumentLayoutPrivate::drawListItem(), QGridLayoutItem::effectiveMaxSize(), QGraphicsLayoutItemPrivate::effectiveSizeHints(), expandSize(), operator>>(), QDeclarativeSizeFValueType::setHeight(), and QTextDocument::setTextWidth().
|
inline |
Sets the width to the given width.
Definition at line 290 of file qsize.h.
Referenced by QPageSetupWidget::_q_paperSizeChanged(), QDeclarativeLoaderPrivate::_q_updateSize(), boundSize(), combineSize(), QDeclarativeColumn::doPositioning(), QDeclarativeRow::doPositioning(), QDeclarativeGrid::doPositioning(), QDeclarativeFlow::doPositioning(), QTextDocumentLayoutPrivate::drawListItem(), QGridLayoutItem::effectiveMaxSize(), QGraphicsLayoutItemPrivate::effectiveSizeHints(), QPicture::exec(), expandSize(), operator>>(), QPainterReplayer::process(), QTextDocument::setTextWidth(), and QDeclarativeSizeFValueType::setWidth().
|
inline |
Returns an integer based copy of this size.
Note that the coordinates in the returned size will be rounded to the nearest integer.
Definition at line 355 of file qsize.h.
Referenced by documentSize(), QVGPaintEngine::drawImage(), QPagePreview::paintEvent(), QMacPrintEnginePrivate::paperSize(), QWhatsThat::QWhatsThat(), QTextEditPrivate::relayoutDocument(), QGraphicsProxyWidget::resizeEvent(), QMacPrintEnginePrivate::setPaperSize(), QGraphicsView::sizeHint(), and QDeclarativeTextPrivate::textDocumentImage().
void QSizeF::transpose | ( | ) |
Swaps the width and height values.
Definition at line 686 of file qsize.cpp.
|
inline |
Returns the width.
Definition at line 284 of file qsize.h.
Referenced by QPlainTextEditPrivate::_q_adjustScrollbars(), _q_boundGeometryToSizeConstraints(), QPageSetupWidget::_q_paperSizeChanged(), QDeclarativeLoaderPrivate::_q_updateSize(), QTextDocument::adjustSize(), QDeclarativePaintedItem::boundingRect(), boundSize(), QGridLayoutItem::box(), QBlitterPaintEnginePrivate::clipAndDrawPixmap(), closestAcceptableSize(), combineSize(), QDeclarativeColumn::doPositioning(), QDeclarativeRow::doPositioning(), QDeclarativeFlow::doPositioning(), QSvgText::draw(), QTextDocumentLayoutPrivate::drawBlock(), QItemDelegate::drawDisplay(), QTextDocumentLayoutPrivate::drawListItem(), QGridLayoutItem::effectiveMaxSize(), QGraphicsLayoutItemPrivate::effectiveSizeHints(), QGridLayoutEngine::ensureGeometries(), epsilonCompare(), expandSize(), QFixedSize::fromSizeF(), QDeclarativeCompiler::genLiteralAssignment(), QGridLayoutItem::geometryWithin(), QTextDocumentLayoutPrivate::layoutBlock(), QTextDocumentLayoutPrivate::layoutFrame(), QGraphicsLayoutItem::maximumWidth(), minimumHeightForWidth(), QGraphicsLayoutItem::minimumWidth(), operator<<(), QPdfBaseEnginePrivate::pageRect(), QPlainTextEdit::paintEvent(), QtopiaPrintEngine::paperRect(), QPdfBaseEnginePrivate::paperRect(), QPdf::paperSize(), QPrinter::paperSize(), QGraphicsLayoutItem::preferredWidth(), QDeclarativeBasePositioner::prePositioning(), qDrawRoundedCorners(), QRectF::QRectF(), qSizeFTopaperSize(), QSvgIOHandler::read(), QTextDocumentLayout::resizeInlineObject(), QAbstractTextDocumentLayout::resizeInlineObject(), QDeclarativeViewPrivate::rootObjectSize(), QGraphicsWidget::setGeometry(), QGraphicsAnchorLayoutPrivate::setItemsGeometries(), QPrinter::setPaperSize(), QPageSetupWidget::setPrinter(), QWin32PrintEngine::setProperty(), QGraphicsLayoutItemPrivate::setSize(), QDeclarativeItem::setSize(), QRectF::setSize(), QTextBrowserPrivate::setSource(), QGLShaderProgram::setUniformValue(), QDeclarativeSizeFValueType::setValue(), sizeForOrientation(), QLabelPrivate::sizeForWidth(), QGridLayoutEngine::sizeHint(), QMacStyle::subControlRect(), QItemDelegate::textRectangle(), QTest::toString(), and QPageSetupWidget::unitChanged().
Returns true if s1 and s2 are different; otherwise returns false.
Definition at line 317 of file qsize.h.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Multiplies the given size by the given factor and returns the result.
Definition at line 326 of file qsize.h.
Divides the given size by the given divisor and returns the result.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 339 of file qsize.h.
|
related |
Returns true if s1 and s2 are equal; otherwise returns false.
Definition at line 314 of file qsize.h.
|
related |
|
private |
Definition at line 245 of file qsize.h.
Referenced by boundedTo(), expandedTo(), height(), isEmpty(), isNull(), isValid(), operator!=(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator==(), QSizeF(), rheight(), scale(), setHeight(), and toSize().
|
private |
Definition at line 244 of file qsize.h.
Referenced by boundedTo(), expandedTo(), isEmpty(), isNull(), isValid(), operator!=(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator==(), QSizeF(), rwidth(), scale(), setWidth(), toSize(), and width().