Qt 4.8
Public Functions | Properties | Friends | Related Functions | List of all members
QSize Class Reference

The QSize class defines the size of a two-dimensional object using integer point precision. More...

#include <qsize.h>

Public Functions

QSize boundedTo (const QSize &) const
 Returns a size holding the minimum width and height of this size and the given otherSize. More...
 
QSize expandedTo (const QSize &) const
 Returns a size holding the maximum width and height of this size and the given otherSize. More...
 
int 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 is 0; otherwise returns false. More...
 
bool isValid () const
 Returns true if both the width and height is equal to or greater than 0; otherwise returns false. More...
 
QSizeoperator*= (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...
 
QSizeoperator+= (const QSize &)
 Adds the given size to this size, and returns a reference to this size. More...
 
QSizeoperator-= (const QSize &)
 Subtracts the given size from this size, and returns a reference to this size. More...
 
QSizeoperator/= (qreal c)
 Divides both the width and height by the given divisor, and returns a reference to the size. More...
 
 QSize ()
 Constructs a size with an invalid width and height (i. More...
 
 QSize (int w, int h)
 Constructs a size with the given width and height. More...
 
int & rheight ()
 Returns a reference to the height. More...
 
int & rwidth ()
 Returns a reference to the width. More...
 
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: More...
 
void scale (const QSize &s, Qt::AspectRatioMode mode)
 Scales the size to a rectangle with the given size, according to the specified mode. More...
 
void setHeight (int h)
 Sets the height to the given height. More...
 
void setWidth (int w)
 Sets the width to the given width. More...
 
void transpose ()
 Swaps the width and height values. More...
 
int width () const
 Returns the width. More...
 

Properties

int ht
 
int wd
 

Friends

bool operator!= (const QSize &, const QSize &)
 Returns true if s1 and s2 are different; otherwise returns false. More...
 
const QSize operator* (const QSize &, qreal)
 
const QSize operator* (qreal, const QSize &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
const QSize operator+ (const QSize &, const QSize &)
 Returns the sum of s1 and s2; each component is added separately. More...
 
const QSize operator- (const QSize &, const QSize &)
 Returns s2 subtracted from s1; each component is subtracted separately. More...
 
const QSize operator/ (const QSize &, qreal)
 Divides the given size by the given divisor, and returns the result rounded to the nearest integer. More...
 
bool operator== (const QSize &, const QSize &)
 Returns true if s1 and s2 are equal; otherwise returns false. More...
 

Related Functions

(Note that these are not member functions.)

QDataStreamoperator<< (QDataStream &stream, const QSize &size)
 Writes the given size to the given stream, and returns a reference to the stream. More...
 
QDataStreamoperator>> (QDataStream &stream, QSize &size)
 Reads a size from the given stream into the given size, and returns a reference to the stream. More...
 

Detailed Description

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, QRect

Definition at line 53 of file qsize.h.

Constructors and Destructors

◆ QSize() [1/2]

QSize::QSize ( )
inline

Constructs a size with an invalid width and height (i.

e., isValid() returns false).

See also
isValid()

Definition at line 111 of file qsize.h.

Referenced by boundedTo(), expandedTo(), operator*(), operator+(), operator-(), operator/(), and scale().

112 { wd = ht = -1; }
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ QSize() [2/2]

QSize::QSize ( int  width,
int  height 
)
inline

Constructs a size with the given width and height.

See also
setWidth(), setHeight()

Definition at line 114 of file qsize.h.

115 { wd = w; ht = h; }
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

Functions

◆ boundedTo()

QSize QSize::boundedTo ( const QSize otherSize) const
inline

◆ expandedTo()

QSize QSize::expandedTo ( const QSize otherSize) const
inline

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

See also
boundedTo(), scale()

Definition at line 187 of file qsize.h.

Referenced by QRenderRule::adjustSize(), QMdiAreaPrivate::appendChild(), QMenuBarPrivate::calcActionRects(), QWorkspace::cascade(), QLayout::closestAcceptableSize(), QStyleSheetStyle::drawComplexControl(), QDockAreaLayout::getGrid(), getNetWmState(), QTabWidget::heightForWidth(), QStackedLayout::minimumSize(), QGroupBox::minimumSizeHint(), QMdiSubWindow::minimumSizeHint(), QMdiArea::minimumSizeHint(), QMenuBar::minimumSizeHint(), QAbstractSpinBox::minimumSizeHint(), QTabWidget::minimumSizeHint(), QTabBar::minimumSizeHint(), QWidgetResizeHandler::mouseMoveEvent(), QStyleSheetStyle::positionRect(), qNormalizeRadii(), qSmartMaxSize(), qSmartMinSize(), QWorkspaceChild::QWorkspaceChild(), QToolBarAreaLayoutItem::realSizeHint(), QMdiAreaPrivate::rearrange(), QComboBoxPrivate::recomputeSizeHint(), QWidget::resize(), QMdiAreaPrivate::resizeToMinimumTileSize(), QMainWindowLayout::setGeometry(), QWidget::setGeometry(), QMdiSubWindowPrivate::setNewGeometry(), QMdiSubWindowPrivate::setNormalMode(), QBoxLayoutPrivate::setupGeom(), QMdiSubWindowPrivate::setWindowFlags(), QWorkspaceChild::showShaded(), QLabelPrivate::sizeForWidth(), QDockWidgetLayout::sizeFromContent(), QMacStyle::sizeFromContents(), QGtkStyle::sizeFromContents(), QStyleSheetStyle::sizeFromContents(), QCheckBox::sizeHint(), QScrollBar::sizeHint(), QColumnView::sizeHint(), QToolBoxButton::sizeHint(), QMdiSubWindow::sizeHint(), QDial::sizeHint(), QSlider::sizeHint(), QStackedLayout::sizeHint(), QMdiArea::sizeHint(), QMenuBar::sizeHint(), QAbstractSpinBox::sizeHint(), QWidgetItem::sizeHint(), QTabWidget::sizeHint(), QMenu::sizeHint(), DetailButton::sizeHint(), QTabBar::sizeHint(), QDateTimeEdit::sizeHint(), QSplitterHandle::sizeHint(), QWizard::sizeHint(), QWorkspaceChild::sizeHint(), QCommonStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QWindowsCEStyle::subControlRect(), QMotifStyle::subControlRect(), QWorkspace::tile(), QMenuPrivate::updateActionRects(), QWidgetItemV2::updateCacheIfNecessary(), and QScrollAreaPrivate::updateScrollBars().

188 {
189  return QSize(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht));
190 }
QSize()
Constructs a size with an invalid width and height (i.
Definition: qsize.h:111
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ height()

int QSize::height ( ) const
inline

Returns the height.

See also
width(), setHeight()

Definition at line 129 of file qsize.h.

Referenced by QTextEditPrivate::_q_adjustScrollbars(), QWorkspacePrivate::_q_showOperationMenu(), QGLFramebufferObjectPool::acquire(), QLayout::activate(), QAxClientSite::activateObject(), QPixmapIconEngine::actualSize(), QIconLoaderEngine::actualSize(), QLayout::addChildWidget(), QGridLayoutPrivate::addData(), QGridLayoutPrivate::addHfwData(), QPushButtonPrivate::adjustedMenuPosition(), QWidgetPrivate::adjustedSize(), QRenderRule::adjustSize(), QWorkspaceChild::adjustToFullscreen(), QStyle::alignedRect(), QLayout::alignmentRect(), QDockAreaLayoutInfo::apply(), QApplicationPrivate::applyX11SpecificCommandLineArguments(), QMacStylePrivate::aquaSizeConstrain(), area(), areaDiff(), QFormLayoutPrivate::arrangeWidgets(), QBalloonTip::balloon(), QWorkspaceChild::baseSize(), basicSize(), QGL2PaintEngineEx::begin(), blitTexture(), QVGCompositionHelper::blitWindow(), QRenderRule::borderClip(), QRenderRule::boxSize(), QMenuBarPrivate::calcActionRects(), QWorkspace::cascade(), QLayout::closestAcceptableSize(), QMacStylePrivate::contentFitsInPushButton(), QRenderRule::contentsSize(), QOpenGLPaintEnginePrivate::copyDrawable(), QImageData::create(), QWidgetPrivate::create_sys(), QDirectFBScreen::createDFBSurface(), QStyleSheetStyle::defaultSize(), QPixmap::depth(), determineScreenSize(), QIconModeViewBase::doBatchedItemLayout(), documentSize(), QIconModeViewBase::doDynamicLayout(), QItemDelegate::doLayout(), QListModeViewBase::doStaticLayout(), QVGPixmapConvolutionFilter::draw(), QVGPixmapColorizeFilter::draw(), QVGPixmapDropShadowFilter::draw(), QVGPixmapBlurFilter::draw(), QAlphaPaintEnginePrivate::drawAlphaImage(), QStyleHelper::drawBorderPixmap(), QCommonStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QMacStyle::drawControl(), QStyleSheetStyle::drawControl(), QOpenGLPaintEnginePrivate::drawItem(), QGraphicsScenePrivate::drawItemHelper(), QGLTrapezoidMaskGenerator::drawMask(), QGLEllipseMaskGenerator::drawMask(), QGL2PaintEngineEx::drawPixmapFragments(), QGL2PaintEngineExPrivate::drawPixmapFragments(), QWindowsVistaStyle::drawPrimitive(), QGL2PaintEngineExPrivate::drawTexture(), drawTexture(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QVistaHelper::drawTitleBar(), effectiveState(), QIconLoaderEngine::entryForSize(), QStatusBar::event(), QAxHostWidget::event(), QWorkspaceChild::eventFilter(), QVGPaintEngine::fillRegion(), QOpenGLPaintEnginePrivate::fillVertexArray(), QIconModeViewBase::filterDropEvent(), QToolBarAreaLayoutInfo::fitLayout(), QToolBarAreaLayout::fitLayout(), QMainWindowLayout::fixSizeInUnifiedToolbar(), QGLWindowSurface::flush(), QVideoSurfaceFormat::frameHeight(), QBitmap::fromData(), QGLPixmapData::fromData(), QGLPixmapData::fromFile(), generateBlurTexture(), QMdi::MinOverlapPlacer::getCandidatePlacements(), QAxServerBase::GetExtent(), QDockAreaLayout::getGrid(), QBBScreenEventHandler::handleTouchEvent(), QVideoFrame::height(), QCommandLinkButton::heightForWidth(), QMenuBar::heightForWidth(), QWidgetItemV2::heightForWidth(), QBoxLayoutItem::hfw(), QMainWindowLayout::hover(), QTreeView::indexRowSizeHint(), QColorDialogPrivate::init(), QGLPixelBufferPrivate::init(), QIconModeViewBase::initBspTree(), QMacStylePrivate::initComboboxBdi(), QIconModeViewBase::initDynamicLayout(), QGLWindowSurface::initializeOffscreenTexture(), initLayoutStruct(), QTabBarPrivate::initStyleBaseOption(), QWidgetPrivate::invalidateBuffer_resizeHelper(), QAxServerBase::Invoke(), QWidget::isEnabledToTLW(), isServerProcess(), QProgressDialogPrivate::layout(), QToolBarLayout::layoutActions(), QTabBarPrivate::layoutTabs(), QDeclarativeBorderImage::load(), QDirectFBPaintDevice::lockSurface(), make_widget_eventUPP(), make_win_eventUPP(), QShivaContext::makeCurrent(), QTransformedScreen::mapFromDevice(), QTransformedScreen::mapToDevice(), QListModeViewBase::mapToViewport(), QDockAreaLayoutInfo::maximumSize(), maybeRoundToNextPowerOfTwo(), menuBarHeightForWidth(), QGLPaintDevice::metric(), QBoxLayoutItem::mhfw(), QDockAreaLayoutInfo::minimumSize(), QToolBarAreaLayout::minimumSize(), QDockAreaLayout::minimumSize(), QMainWindowLayout::minimumSize(), QCommandLinkButton::minimumSizeHint(), QMdiSubWindow::minimumSizeHint(), QDialog::minimumSizeHint(), QMenuBar::minimumSizeHint(), QLabel::minimumSizeHint(), QTabBar::minimumSizeHint(), QListView::moveCursor(), nearest_gl_texture_size(), QWaylandEglWindow::newSurfaceCreated(), QWaylandWindow::newSurfaceCreated(), operator<<(), operator>>(), QTreeViewPrivate::paintAlternatingRowColors(), QGtkPainter::paintBox(), QGtkPainter::paintBoxGap(), QGraphicsWidget::paintWindowFrame(), QMacPrintEnginePrivate::paperSize(), parseGeometry(), QWSYellowSurface::permanentState(), perp(), QSplitterLayoutStruct::pick(), QSplitterPrivate::pick(), pick(), QCommonStyle::pixelMetric(), QMacStyle::pixelMetric(), QStyleSheetStyle::pixelMetric(), PixmapEntry::pixmap(), QPixmapIconEngine::pixmap(), QSvgIconEnginePrivate::pmcKey(), pmKey(), QMenu::popup(), QToolButtonPrivate::popupTimerDone(), QDateTimeEditPrivate::positionCalendarPopup(), QStyleSheetStyle::positionRect(), QGLPixmapBlurFilter::processGL(), QVideoSurfaceFormat::property(), QMacStylePrivate::pushButtonSizeFromContents(), PvrEglWindowSurface::PvrEglWindowSurface(), QDirectFbBlitter::QDirectFbBlitter(), qDrawBorder(), qHash(), qNormalizeRadii(), QPixmap::QPixmap(), QRect::QRect(), QRollEffect::QRollEffect(), qSmartMaxSize(), qSmartMinSize(), qt_aqua_get_known_size(), qt_aqua_guess_size(), qt_defaultDpiY(), qt_format_to_attrib_list(), qt_mac_widget_in_menu_eventHandler(), QtWndProc(), QGLMaskTextureCache::quadtreeFindAvailableLocation(), QGLMaskTextureCache::quadtreeFindExistingLocation(), QVNCDirtyMap::QVNCDirtyMap(), QWaylandShmBuffer::QWaylandShmBuffer(), QWaylandXCompositeBuffer::QWaylandXCompositeBuffer(), QWorkspaceChild::QWorkspaceChild(), QXcbShmImage::QXcbShmImage(), QSvgIOHandler::read(), read_jpeg_image(), QPFGlyphTree::readData(), readImage(), QGraphicsViewPrivate::recalculateContentSize(), QComboBoxPrivate::recomputeSizeHint(), QToolBarAreaLayout::rectHint(), QStatusBar::reformat(), QTextEditPrivate::relayoutDocument(), QDeclarativeBorderImage::requestFinished(), QCocoaWindowSurface::resize(), QBBRootWindow::resize(), QRubberBand::resize(), QListViewItem::resize(), QWidget::resize(), QXlibWindowSurface::resizeBuffer(), QColumnViewPreviewColumn::resizeEvent(), QListView::resizeEvent(), QWorkspaceChild::resizeEvent(), QMdiAreaPrivate::resizeToMinimumTileSize(), QAlphaWidget::run(), QPixmap::scaled(), QImage::scaled(), QmlJSDebugger::ZoomTool::scaleView(), QVGEGLWindowSurfaceDirect::scroll(), QHeaderView::sectionSizeFromContents(), QHeaderView::sectionSizeHint(), QPageSetupWidget::selectPrinter(), QWidget::setBaseSize(), QBlittablePixmapData::setBlittable(), QBBWindow::setBufferSize(), QHeaderView::setDefaultSectionSize(), QBoxLayout::setDirection(), QAxServerBase::SetExtent(), QWidget::setFixedSize(), QSplitterPrivate::setGeo(), QX11GLWindowSurface::setGeometry(), QX11WindowSurface::setGeometry(), QWidgetItem::setGeometry(), QStyleSheetStyle::setGeometry(), QWSLocalMemSurface::setGeometry(), QWSSharedMemSurface::setGeometry(), QDeclarativeBorderImage::setGridScaledImage(), QWidget::setMaximumSize(), QLayout::setMenuBar(), QWidget::setMinimumSize(), QMdiSubWindowPrivate::setNewGeometry(), QGLMaskTextureCache::setOffscreenSize(), QMacPrintEnginePrivate::setPaperSize(), QBBScreen::setRotation(), QListView::setSelection(), QRect::setSize(), QWidget::setSizeIncrement(), QTransformedScreen::setTransformation(), QGLShaderProgram::setUniformValue(), QWizardHeader::setup(), QBoxLayoutPrivate::setupGeom(), QGridLayoutPrivate::setupHfwLayoutData(), QFormLayoutPrivate::setupHfwLayoutData(), QFormLayoutPrivate::setupVerticalLayoutData(), QDeclarativeSizeValueType::setValue(), QMdiSubWindowPrivate::setWindowFlags(), QDialog::showExtension(), QCompleterPrivate::showPopup(), QDockWidgetLayout::sizeFromContent(), QWindowsVistaStyle::sizeFromContents(), QPlastiqueStyle::sizeFromContents(), QWindowsMobileStyle::sizeFromContents(), QCommonStyle::sizeFromContents(), QWindowsCEStyle::sizeFromContents(), QCleanlooksStyle::sizeFromContents(), QWindowsXPStyle::sizeFromContents(), QWindowsStyle::sizeFromContents(), QMotifStyle::sizeFromContents(), QMacStyle::sizeFromContents(), QGtkStyle::sizeFromContents(), QStyleSheetStyle::sizeFromContents(), QRadioButton::sizeHint(), QCheckBox::sizeHint(), QPushButton::sizeHint(), QScrollArea::sizeHint(), QToolBoxButton::sizeHint(), QWorkspace::sizeHint(), QToolButton::sizeHint(), QDialog::sizeHint(), QProgressDialog::sizeHint(), QMdiArea::sizeHint(), QMenuBar::sizeHint(), QDockWidgetTitleButton::sizeHint(), QVideoSurfaceFormat::sizeHint(), QMenu::sizeHint(), QDockAreaLayoutInfo::sizeHint(), QWizard::sizeHint(), QToolBarAreaLayout::sizeHint(), QDockAreaLayout::sizeHint(), QMainWindowLayout::sizeHint(), QTableView::sizeHintForRow(), QIconModeViewBase::snapToGrid(), QWidgetBackingStore::staticContents(), QCommonStyle::subControlRect(), QWindowsVistaStyle::subControlRect(), QWindowsXPStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QWindowsCEStyle::subControlRect(), QMotifStyle::subControlRect(), QGtkStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QStyleSheetStyle::subElementRect(), QWaylandReadbackGlxContext::swapBuffers(), QWaylandReadbackEglContext::swapBuffers(), QDockAreaLayoutInfo::tabContentRect(), QCommonStylePrivate::tabLayout(), QTabBar::tabSizeHint(), QItemDelegate::textRectangle(), QWorkspace::tile(), QTest::toString(), QLayout::totalMaximumSize(), QSplitterPrivate::trans(), QDirectFBPixmapData::transformed(), QETWidget::translateConfigEvent(), QStyleHelper::uniqueName(), uniqueName(), QMenuPrivate::updateActionRects(), ShaderEffectSource::updateBackbuffer(), QGL2PaintEngineExPrivate::updateBrushTexture(), QCalendarTextNavigator::updateDateLabel(), QOpenGLPaintEnginePrivate::updateDepthClip(), QOpenGLPaintEnginePrivate::updateFragmentProgramData(), QTableView::updateGeometries(), QTreeView::updateGeometries(), QGLWindowSurface::updateGeometry(), ShaderEffectItem::updateGeometry(), QAxServerBase::updateGeometry(), QWizardPrivate::updateMinMaxSizes(), ShaderEffect::updateRenderTargets(), QScrollAreaPrivate::updateScrollBars(), QTreeViewPrivate::updateScrollBars(), QMdiAreaPrivate::updateScrollBars(), QDeclarativeTextPrivate::updateSize(), QMessageBoxPrivate::updateSize(), ShaderEffectSource::updateSizeAndTexture(), QMdiAreaPrivate::updateTabBarGeometry(), QCommonListViewBase::updateVerticalScrollBar(), QListModeViewBase::updateVerticalScrollBar(), useScrollBar(), QSettingsPrivate::variantToString(), QCommonStylePrivate::viewItemLayout(), QCommonStylePrivate::viewItemSize(), and QPdfEnginePrivate::writePage().

130 { return ht; }
int ht
Definition: qsize.h:93

◆ isEmpty()

bool QSize::isEmpty ( ) const
inline

◆ isNull()

bool QSize::isNull ( ) const
inline

◆ isValid()

bool QSize::isValid ( ) const
inline

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

See also
isNull(), isEmpty()

Definition at line 123 of file qsize.h.

Referenced by QWorkspace::addWindow(), QWidgetPrivate::adjustedSize(), QWidget::adjustSize(), QFormLayoutPrivate::arrangeWidgets(), QPixmapIconEngine::bestMatch(), QWorkspace::cascade(), QImageData::create(), QIconModeViewBase::doDynamicLayout(), QListViewPrivate::doItemsLayout(), QListModeViewBase::doStaticLayout(), QGraphicsScenePrivate::drawItemHelper(), QRenderRule::fixupBorder(), QDockAreaLayout::getGrid(), QSplitterLayoutStruct::getWidgetSize(), QListModeViewBase::indexToListViewItem(), QIconModeViewBase::initDynamicLayout(), QToolButton::initStyleOption(), QVideoSurfaceFormat::isValid(), QListViewPrivate::itemSize(), QMdiSubWindow::minimumSizeHint(), QAxWidget::minimumSizeHint(), QSplitter::minimumSizeHint(), QAxHostWidget::minimumSizeHint(), QWaylandEglWindow::newSurfaceCreated(), QMoviePrivate::next(), QTiffHandler::option(), QApplicationPrivate::qt_mac_apply_settings(), QSvgIOHandler::read(), QImageReader::read(), QComboBoxPrivate::recomputeSizeHint(), QAxServerBase::resize(), QMdiAreaPrivate::resizeToMinimumTileSize(), QGraphicsItem::scroll(), QMainWindow::setIconSize(), QToolBar::setIconSize(), QMdiSubWindowPrivate::setMaximizeMode(), QListView::setSelection(), QAxWidget::sizeHint(), QSplitter::sizeHint(), QMacStyle::styleHint(), QCommonStylePrivate::tabLayout(), QAxServerBase::updateGeometry(), QGraphicsProxyWidgetPrivate::updateProxyGeometryFromWidget(), QTreeViewPrivate::updateScrollBars(), QDeclarativeViewPrivate::updateSize(), and QApplicationPrivate::x11_apply_settings().

124 { return wd>=0 && ht>=0; }
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ operator*=()

QSize & QSize::operator*= ( qreal  factor)
inline

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.

Note that the result is rounded to the nearest integer.

See also
scale()

Definition at line 153 of file qsize.h.

154 { wd = qRound(wd*c); ht = qRound(ht*c); return *this; }
unsigned char c[8]
Definition: qnumeric_p.h:62
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator+=()

QSize & QSize::operator+= ( const QSize size)
inline

Adds the given size to this size, and returns a reference to this size.

For example:

QSize s( 3, 7);
QSize r(-1, 4);
s += r;
// s becomes (2,11)

Definition at line 147 of file qsize.h.

148 { wd+=s.wd; ht+=s.ht; return *this; }
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ operator-=()

QSize & QSize::operator-= ( const QSize size)
inline

Subtracts the given size from this size, and returns a reference to this size.

For example:

QSize s( 3, 7);
QSize r(-1, 4);
s -= r;
// s becomes (4,3)

Definition at line 150 of file qsize.h.

151 { wd-=s.wd; ht-=s.ht; return *this; }
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ operator/=()

QSize & QSize::operator/= ( qreal  divisor)
inline

Divides both the width and height by the given divisor, and returns a reference to the size.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note that the result is rounded to the nearest integer.

See also
QSize::scale()

Definition at line 174 of file qsize.h.

175 {
177  wd = qRound(wd/c); ht = qRound(ht/c);
178  return *this;
179 }
unsigned char c[8]
Definition: qnumeric_p.h:62
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
int ht
Definition: qsize.h:93
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Definition: qglobal.h:2043
int wd
Definition: qsize.h:92
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ rheight()

int & QSize::rheight ( )
inline

◆ rwidth()

int & QSize::rwidth ( )
inline

◆ scale() [1/2]

void QSize::scale ( int  width,
int  height,
Qt::AspectRatioMode  mode 
)
inline

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(10, 12);
t1.scale(60, 60, Qt::IgnoreAspectRatio);
// t1 is (60, 60)
QSize t2(10, 12);
t2.scale(60, 60, Qt::KeepAspectRatio);
// t2 is (50, 60)
QSize t3(10, 12);
// t3 is (60, 72)
See also
setWidth(), setHeight()

Definition at line 138 of file qsize.h.

Referenced by QPixmapIconEngine::actualSize(), QSvgIconEngine::pixmap(), QPixmapIconEngine::pixmap(), QBBScreen::resizeTopLevelWindow(), QPixmap::scaled(), and QImage::scaled().

139 { scale(QSize(w, h), mode); }
QSize()
Constructs a size with an invalid width and height (i.
Definition: qsize.h:111
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: ...
Definition: qsize.h:138

◆ scale() [2/2]

void QSize::scale ( const QSize 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 236 of file qsize.cpp.

237 {
238  if (mode == Qt::IgnoreAspectRatio || wd == 0 || ht == 0) {
239  wd = s.wd;
240  ht = s.ht;
241  } else {
242  bool useHeight;
243  qint64 rw = qint64(s.ht) * qint64(wd) / qint64(ht);
244 
245  if (mode == Qt::KeepAspectRatio) {
246  useHeight = (rw <= s.wd);
247  } else { // mode == Qt::KeepAspectRatioByExpanding
248  useHeight = (rw >= s.wd);
249  }
250 
251  if (useHeight) {
252  wd = rw;
253  ht = s.ht;
254  } else {
255  ht = qint32(qint64(s.wd) * qint64(ht) / qint64(wd));
256  wd = s.wd;
257  }
258  }
259 }
int qint32
Definition: qglobal.h:937
__int64 qint64
Definition: qglobal.h:942
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ setHeight()

void QSize::setHeight ( int  height)
inline

Sets the height to the given height.

See also
rheight(), height(), setWidth()

Definition at line 135 of file qsize.h.

Referenced by QGLFramebufferObjectPool::acquire(), QLayout::activate(), QAxClientSite::activateObject(), QWidgetPrivate::adjustedSize(), QRenderRule::adjustSize(), QLayout::alignmentRect(), QRenderRule::boxSize(), QLayout::closestAcceptableSize(), QRenderRule::contentsSize(), QStyleSheetStyle::defaultSize(), documentSize(), QItemDelegate::doLayout(), QWindowsVistaStyle::drawControl(), QProgressDialogPrivate::layout(), QGridLayout::maximumSize(), QBoxLayout::maximumSize(), QToolBarAreaLayout::minimumSize(), QCommandLinkButton::minimumSizeHint(), QSlider::minimumSizeHint(), QMenuBar::minimumSizeHint(), QMenu::popup(), QStyleSheetStyle::positionRect(), QMacStylePrivate::pushButtonSizeFromContents(), qSmartMaxSize(), qSmartMinSize(), qt_aqua_get_known_size(), readImage(), QToolBarAreaLayoutItem::realSizeHint(), QComboBoxPrivate::recomputeSizeHint(), QDeclarativeViewPrivate::rootObjectSize(), QWidgetItem::setGeometry(), QSvgTinyDocument::setHeight(), QDeclarativeSizeValueType::setHeight(), QMdiSubWindowPrivate::setMaximizeMode(), QMdiSubWindowPrivate::setNormalMode(), QGridLayoutPrivate::setupHfwLayoutData(), QDockWidgetLayout::sizeFromContent(), QWindowsVistaStyle::sizeFromContents(), QPlastiqueStyle::sizeFromContents(), QWindowsMobileStyle::sizeFromContents(), QCommonStyle::sizeFromContents(), QWindowsCEStyle::sizeFromContents(), QCleanlooksStyle::sizeFromContents(), QWindowsStyle::sizeFromContents(), QWindowsXPStyle::sizeFromContents(), QMacStyle::sizeFromContents(), QGtkStyle::sizeFromContents(), QStyleSheetStyle::sizeFromContents(), QCommandLinkButton::sizeHint(), QScrollArea::sizeHint(), QMenuBar::sizeHint(), QWidgetItem::sizeHint(), QMenu::sizeHint(), QWizard::sizeHint(), QToolBarAreaLayout::sizeHint(), QCommonStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QWindowsCEStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMotifStyle::subControlRect(), QGtkStyle::subControlRect(), QLayout::totalSizeHint(), QETWidget::translateConfigEvent(), QMenuPrivate::updateActionRects(), QAxServerBase::updateGeometry(), QWizardPrivate::updateMinMaxSizes(), ShaderEffectSource::updateSizeAndTexture(), and QCommonStylePrivate::viewItemLayout().

136 { ht = h; }
int ht
Definition: qsize.h:93

◆ setWidth()

void QSize::setWidth ( int  width)
inline

Sets the width to the given width.

See also
rwidth(), width(), setHeight()

Definition at line 132 of file qsize.h.

Referenced by QGLFramebufferObjectPool::acquire(), QLayout::activate(), QAxClientSite::activateObject(), QWidgetPrivate::adjustedSize(), QMenuPrivate::adjustMenuSizeForScreen(), QRenderRule::adjustSize(), QLayout::alignmentRect(), QRenderRule::boxSize(), QRenderRule::contentsSize(), QStyleSheetStyle::defaultSize(), QWindowsVistaStyle::drawControl(), QWindowsVistaStyle::drawPrimitive(), QListModeViewBase::indexToListViewItem(), QGridLayout::maximumSize(), QBoxLayout::maximumSize(), QToolBarAreaLayout::minimumSize(), QSlider::minimumSizeHint(), QMenuBar::minimumSizeHint(), QStyleSheetStyle::positionRect(), QMacStylePrivate::pushButtonSizeFromContents(), qSmartMaxSize(), qSmartMinSize(), qt_aqua_get_known_size(), readImage(), QToolBarAreaLayoutItem::realSizeHint(), QComboBoxPrivate::recomputeSizeHint(), QDeclarativeViewPrivate::rootObjectSize(), QWidgetItem::setGeometry(), QMdiSubWindowPrivate::setMaximizeMode(), QMdiSubWindowPrivate::setNormalMode(), QSvgTinyDocument::setWidth(), QDeclarativeSizeValueType::setWidth(), QDockWidgetLayout::sizeFromContent(), QCommonStyle::sizeFromContents(), QCleanlooksStyle::sizeFromContents(), QWindowsStyle::sizeFromContents(), QMotifStyle::sizeFromContents(), QMacStyle::sizeFromContents(), QGtkStyle::sizeFromContents(), QStyleSheetStyle::sizeFromContents(), QCommandLinkButton::sizeHint(), QScrollArea::sizeHint(), QToolButton::sizeHint(), QFontComboBox::sizeHint(), QMenuBar::sizeHint(), QVideoSurfaceFormat::sizeHint(), QWidgetItem::sizeHint(), QMenu::sizeHint(), QWizard::sizeHint(), QToolBarAreaLayout::sizeHint(), QCommonStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QWindowsCEStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMotifStyle::subControlRect(), QGtkStyle::subControlRect(), QETWidget::translateConfigEvent(), QMenuPrivate::updateActionRects(), QWidgetItemV2::updateCacheIfNecessary(), updateFormLayoutItem(), QAxServerBase::updateGeometry(), QWizardPrivate::updateMinMaxSizes(), QDeclarativeViewPrivate::updateSize(), and ShaderEffectSource::updateSizeAndTexture().

133 { wd = w; }
int wd
Definition: qsize.h:92

◆ transpose()

void QSize::transpose ( )

◆ width()

int QSize::width ( ) const
inline

Returns the width.

See also
height(), setWidth()

Definition at line 126 of file qsize.h.

Referenced by QTextEditPrivate::_q_adjustScrollbars(), QWorkspacePrivate::_q_showOperationMenu(), QCalendarWidgetPrivate::_q_yearClicked(), QGLFramebufferObjectPool::acquire(), QLayout::activate(), QAxClientSite::activateObject(), QPixmapIconEngine::actualSize(), QIconLoaderEngine::actualSize(), QLayout::addChildWidget(), QGridLayoutPrivate::addData(), QPushButtonPrivate::adjustedMenuPosition(), QWidgetPrivate::adjustedSize(), QRenderRule::adjustSize(), QStyle::alignedRect(), QLayout::alignmentRect(), QDockAreaLayoutInfo::apply(), QApplicationPrivate::applyX11SpecificCommandLineArguments(), QMacStylePrivate::aquaSizeConstrain(), area(), areaDiff(), QFormLayoutPrivate::arrangeWidgets(), QBalloonTip::balloon(), basicSize(), QGL2PaintEngineEx::begin(), blitTexture(), QRenderRule::borderClip(), QRenderRule::boxSize(), QMenuBarPrivate::calcActionRects(), QWorkspace::cascade(), QLayout::closestAcceptableSize(), QComboBoxPrivate::computeWidthHint(), QMacStylePrivate::contentFitsInPushButton(), QRenderRule::contentsSize(), QOpenGLPaintEnginePrivate::copyDrawable(), QImageData::create(), QWidgetPrivate::create_sys(), QColumnViewPrivate::createColumn(), QDirectFBScreen::createDFBSurface(), QStyleSheetStyle::defaultSize(), QPixmap::depth(), determineScreenSize(), QIconModeViewBase::doBatchedItemLayout(), QIconModeViewBase::doDynamicLayout(), QItemDelegate::doLayout(), QLayoutPrivate::doResize(), QListModeViewBase::doStaticLayout(), QVGPixmapConvolutionFilter::draw(), QVGPixmapColorizeFilter::draw(), QVGPixmapDropShadowFilter::draw(), QVGPixmapBlurFilter::draw(), QAlphaPaintEnginePrivate::drawAlphaImage(), QStyleHelper::drawBorderPixmap(), QCommonStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QWindowsXPStyle::drawControl(), QStyleSheetStyle::drawControl(), QGraphicsScenePrivate::drawItemHelper(), QGL2PaintEngineEx::drawPixmapFragments(), QGL2PaintEngineExPrivate::drawPixmapFragments(), QWindowsVistaStyle::drawPrimitive(), QGL2PaintEngineExPrivate::drawTexture(), drawTexture(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), effectiveState(), QIconLoaderEngine::entryForSize(), QAxHostWidget::event(), QMainWindowTabBar::event(), QMenuBar::eventFilter(), QTabBarPrivate::extraWidth(), QIconModeViewBase::filterDropEvent(), QToolBarAreaLayoutInfo::fitLayout(), QToolBarAreaLayout::fitLayout(), QMainWindowLayout::fixSizeInUnifiedToolbar(), QGLWindowSurface::flush(), QVideoSurfaceFormat::frameWidth(), QBitmap::fromData(), QGLPixmapData::fromData(), QGLPixmapData::fromFile(), generateBlurTexture(), QMdi::MinOverlapPlacer::getCandidatePlacements(), QAxServerBase::GetExtent(), QDockAreaLayout::getGrid(), QComboMenuDelegate::getStyleOption(), handleSizeAttribute(), QBBScreenEventHandler::handleTouchEvent(), QTabWidget::heightForWidth(), QWidgetItemV2::heightForWidth(), QMainWindowLayout::hover(), QListModeViewBase::indexToListViewItem(), QColorDialogPrivate::init(), QGLPixelBufferPrivate::init(), QIconModeViewBase::initBspTree(), QIconModeViewBase::initDynamicLayout(), QGLWindowSurface::initializeOffscreenTexture(), QTabBarPrivate::initStyleBaseOption(), QTabWidget::initStyleOption(), QWidgetPrivate::invalidateBuffer_resizeHelper(), QAxServerBase::Invoke(), QWidget::isEnabledToTLW(), isServerProcess(), QProgressDialogPrivate::layout(), QToolBarLayout::layoutActions(), QMessageBoxPrivate::layoutMinimumWidth(), QTabBarPrivate::layoutTabs(), QDeclarativeBorderImage::load(), QDirectFBPaintDevice::lockSurface(), make_widget_eventUPP(), make_win_eventUPP(), QShivaContext::makeCurrent(), QTransformedScreen::mapFromDevice(), QTransformedScreen::mapToDevice(), QListModeViewBase::mapToViewport(), QDockAreaLayoutInfo::maximumSize(), maybeRoundToNextPowerOfTwo(), QMenuBarPrivate::menuRect(), QGLPaintDevice::metric(), QDockAreaLayoutInfo::minimumSize(), QToolBarAreaLayout::minimumSize(), QDockAreaLayout::minimumSize(), QMainWindowLayout::minimumSize(), QMdiSubWindow::minimumSizeHint(), QMenuBar::minimumSizeHint(), QColumnViewGrip::mouseDoubleClickEvent(), QListView::moveCursor(), nearest_gl_texture_size(), QWaylandEglWindow::newSurfaceCreated(), QWaylandWindow::newSurfaceCreated(), operator<<(), operator>>(), QFontFamilyDelegate::paint(), QGtkPainter::paintBox(), QGtkPainter::paintBoxGap(), QListView::paintEvent(), QFileDialogComboBox::paintEvent(), QGraphicsWidget::paintWindowFrame(), QMacPrintEnginePrivate::paperSize(), parseGeometry(), QWSYellowSurface::permanentState(), perp(), QSplitterLayoutStruct::pick(), QSplitterPrivate::pick(), pick(), QCommonStyle::pixelMetric(), QMacStyle::pixelMetric(), QStyleSheetStyle::pixelMetric(), PixmapEntry::pixmap(), QPixmapIconEngine::pixmap(), QSvgIconEnginePrivate::pmcKey(), pmKey(), QMenu::popup(), QToolButtonPrivate::popupTimerDone(), QDateTimeEditPrivate::positionCalendarPopup(), QStyleSheetStyle::positionRect(), QGLPixmapBlurFilter::processGL(), QVideoSurfaceFormat::property(), QMacStylePrivate::pushButtonSizeFromContents(), PvrEglWindowSurface::PvrEglWindowSurface(), QBalloonTip::QBalloonTip(), QDirectFbBlitter::QDirectFbBlitter(), qDrawBorder(), qHash(), qNormalizeRadii(), QPixmap::QPixmap(), QRect::QRect(), QRollEffect::QRollEffect(), qSmartMaxSize(), qSmartMinSize(), qt_aqua_get_known_size(), qt_aqua_guess_size(), qt_defaultDpiX(), qt_format_to_attrib_list(), qt_mac_widget_in_menu_eventHandler(), QGLMaskTextureCache::quadtreeFindAvailableLocation(), QGLMaskTextureCache::quadtreeFindExistingLocation(), QVNCDirtyMap::QVNCDirtyMap(), QWaylandShmBuffer::QWaylandShmBuffer(), QWaylandXCompositeBuffer::QWaylandXCompositeBuffer(), QWorkspaceChild::QWorkspaceChild(), QXcbShmImage::QXcbShmImage(), QSvgIOHandler::read(), read_jpeg_image(), readImage(), QGraphicsViewPrivate::recalculateContentSize(), QComboBoxPrivate::recomputeSizeHint(), QToolBarAreaLayout::rectHint(), QDeclarativeBorderImage::requestFinished(), QCocoaWindowSurface::resize(), QBBRootWindow::resize(), QRubberBand::resize(), QListViewItem::resize(), QWidget::resize(), QXlibWindowSurface::resizeBuffer(), QColumnViewPreviewColumn::resizeEvent(), QListView::resizeEvent(), QWizard::resizeEvent(), QPlainTextEdit::resizeEvent(), QTextEdit::resizeEvent(), QMdiAreaPrivate::resizeToMinimumTileSize(), QAlphaWidget::run(), QPixmap::scaled(), QImage::scaled(), QmlJSDebugger::ZoomTool::scaleView(), QColumnView::scrollTo(), QHeaderView::sectionSizeFromContents(), QHeaderView::sectionSizeHint(), QPageSetupWidget::selectPrinter(), QWidget::setBaseSize(), QBlittablePixmapData::setBlittable(), QBBWindow::setBufferSize(), QHeaderView::setDefaultSectionSize(), QBoxLayout::setDirection(), QAxServerBase::SetExtent(), QWidget::setFixedSize(), QSplitterPrivate::setGeo(), QX11GLWindowSurface::setGeometry(), QX11WindowSurface::setGeometry(), QBoxLayout::setGeometry(), QWidgetItem::setGeometry(), QStyleSheetStyle::setGeometry(), QWSLocalMemSurface::setGeometry(), QWSSharedMemSurface::setGeometry(), QDeclarativeBorderImage::setGridScaledImage(), QWidget::setMaximumSize(), QWidget::setMinimumSize(), QMdiSubWindowPrivate::setNewGeometry(), QGLMaskTextureCache::setOffscreenSize(), QMacPrintEnginePrivate::setPaperSize(), QBBScreen::setRotation(), QListView::setSelection(), QRect::setSize(), QWidget::setSizeIncrement(), QTransformedScreen::setTransformation(), QGLShaderProgram::setUniformValue(), QBoxLayoutPrivate::setupGeom(), QFormLayoutPrivate::setupHorizontalLayoutData(), QFormLayoutPrivate::setupVerticalLayoutData(), QUrlModel::setUrl(), QDeclarativeSizeValueType::setValue(), QMdiSubWindowPrivate::setWindowFlags(), QDialog::showExtension(), QLabelPrivate::sizeForWidth(), QDockWidgetLayout::sizeFromContent(), QWindowsMobileStyle::sizeFromContents(), QCommonStyle::sizeFromContents(), QWindowsCEStyle::sizeFromContents(), QCleanlooksStyle::sizeFromContents(), QWindowsStyle::sizeFromContents(), QMotifStyle::sizeFromContents(), QMacStyle::sizeFromContents(), QGtkStyle::sizeFromContents(), QStyleSheetStyle::sizeFromContents(), QRadioButton::sizeHint(), QCheckBox::sizeHint(), QCommandLinkButton::sizeHint(), QPushButton::sizeHint(), QScrollArea::sizeHint(), QToolBoxButton::sizeHint(), QWorkspace::sizeHint(), QToolButton::sizeHint(), QProgressDialog::sizeHint(), QMdiArea::sizeHint(), QMenuBar::sizeHint(), QDockWidgetTitleButton::sizeHint(), QVideoSurfaceFormat::sizeHint(), QMenu::sizeHint(), QDockAreaLayoutInfo::sizeHint(), QWizard::sizeHint(), QToolBarAreaLayout::sizeHint(), QDockAreaLayout::sizeHint(), QMainWindowLayout::sizeHint(), QFileDialogTreeView::sizeHint(), QTableView::sizeHintForColumn(), QTreeView::sizeHintForColumn(), QIconModeViewBase::snapToGrid(), QWidgetBackingStore::staticContents(), QCommonStyle::subControlRect(), QWindowsVistaStyle::subControlRect(), QWindowsXPStyle::subControlRect(), QWindowsMobileStyle::subControlRect(), QWindowsCEStyle::subControlRect(), QCleanlooksStyle::subControlRect(), QMotifStyle::subControlRect(), QGtkStyle::subControlRect(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QStyleSheetStyle::subElementRect(), QWaylandReadbackEglContext::swapBuffers(), QWaylandReadbackGlxContext::swapBuffers(), QDockAreaLayoutInfo::tabContentRect(), QCommonStylePrivate::tabLayout(), QTabBar::tabSizeHint(), QItemDelegatePrivate::textLayoutBounds(), QItemDelegate::textRectangle(), QWorkspace::tile(), QStyleSheetStyle::titleBarLayout(), QTest::toString(), QLayout::totalMaximumSize(), QLayout::totalMinimumSize(), QLayout::totalSizeHint(), QSplitterPrivate::trans(), QDirectFBPixmapData::transformed(), QETWidget::translateConfigEvent(), QStyleHelper::uniqueName(), uniqueName(), QMenuPrivate::updateActionRects(), ShaderEffectSource::updateBackbuffer(), QGL2PaintEngineExPrivate::updateBrushTexture(), QCalendarTextNavigator::updateDateLabel(), QStyledItemDelegate::updateEditorGeometry(), updateFormLayoutItem(), QOpenGLPaintEnginePrivate::updateFragmentProgramData(), QMenuBarPrivate::updateGeometries(), QTableView::updateGeometries(), QGLWindowSurface::updateGeometry(), ShaderEffectItem::updateGeometry(), QAxServerBase::updateGeometry(), QCommonListViewBase::updateHorizontalScrollBar(), QListModeViewBase::updateHorizontalScrollBar(), QExpandingLineEdit::updateMinimumWidth(), QWizardPrivate::updateMinMaxSizes(), ShaderEffect::updateRenderTargets(), QScrollAreaPrivate::updateScrollBars(), QColumnViewPrivate::updateScrollbars(), QTreeViewPrivate::updateScrollBars(), QMdiAreaPrivate::updateScrollBars(), QDeclarativeTextPrivate::updateSize(), QMessageBoxPrivate::updateSize(), ShaderEffectSource::updateSizeAndTexture(), QFormLayoutPrivate::updateSizes(), useScrollBar(), QSettingsPrivate::variantToString(), QCommonStylePrivate::viewItemLayout(), QCommonStylePrivate::viewItemSize(), QVideoFrame::width(), and QPdfEnginePrivate::writePage().

127 { return wd; }
int wd
Definition: qsize.h:92

Friends and Related Functions

◆ operator!=

bool operator!= ( const QSize s1,
const QSize s2 
)
friend

Returns true if s1 and s2 are different; otherwise returns false.

Definition at line 159 of file qsize.h.

160 { return s1.wd != s2.wd || s1.ht != s2.ht; }
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ operator* [1/2]

const QSize operator* ( const QSize size,
qreal  factor 
)
friend

Multiplies the given size by the given factor, and returns the result rounded to the nearest integer.

See also
QSize::scale()

Definition at line 168 of file qsize.h.

169 { return QSize(qRound(s.wd*c), qRound(s.ht*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
QSize()
Constructs a size with an invalid width and height (i.
Definition: qsize.h:111
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator* [2/2]

const QSize operator* ( qreal  factor,
const QSize size 
)
friend

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 rounded to the nearest integer.

Definition at line 171 of file qsize.h.

172 { return QSize(qRound(s.wd*c), qRound(s.ht*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
QSize()
Constructs a size with an invalid width and height (i.
Definition: qsize.h:111
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator+

const QSize operator+ ( const QSize s1,
const QSize s2 
)
friend

Returns the sum of s1 and s2; each component is added separately.

Definition at line 162 of file qsize.h.

163 { return QSize(s1.wd+s2.wd, s1.ht+s2.ht); }
QSize()
Constructs a size with an invalid width and height (i.
Definition: qsize.h:111
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ operator-

const QSize operator- ( const QSize s1,
const QSize s2 
)
friend

Returns s2 subtracted from s1; each component is subtracted separately.

Definition at line 165 of file qsize.h.

166 { return QSize(s1.wd-s2.wd, s1.ht-s2.ht); }
QSize()
Constructs a size with an invalid width and height (i.
Definition: qsize.h:111
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ operator/

const QSize operator/ ( const QSize size,
qreal  divisor 
)
friend

Divides the given size by the given divisor, and returns the result rounded to the nearest integer.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

See also
QSize::scale()

Definition at line 181 of file qsize.h.

182 {
184  return QSize(qRound(s.wd/c), qRound(s.ht/c));
185 }
unsigned char c[8]
Definition: qnumeric_p.h:62
QSize()
Constructs a size with an invalid width and height (i.
Definition: qsize.h:111
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Definition: qglobal.h:2043
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator<<()

QDataStream & operator<< ( QDataStream stream,
const QSize size 
)
related

Writes the given size to the given stream, and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 461 of file qsize.cpp.

Referenced by boundedTo().

462 {
463  if (s.version() == 1)
464  s << (qint16)sz.width() << (qint16)sz.height();
465  else
466  s << (qint32)sz.width() << (qint32)sz.height();
467  return s;
468 }
int qint32
Definition: qglobal.h:937
short qint16
Definition: qglobal.h:935

◆ operator==

bool operator== ( const QSize s1,
const QSize s2 
)
friend

Returns true if s1 and s2 are equal; otherwise returns false.

Definition at line 156 of file qsize.h.

157 { return s1.wd == s2.wd && s1.ht == s2.ht; }
int ht
Definition: qsize.h:93
int wd
Definition: qsize.h:92

◆ operator>>()

QDataStream & operator>> ( QDataStream stream,
QSize size 
)
related

Reads a size from the given stream into the given size, and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 483 of file qsize.cpp.

484 {
485  if (s.version() == 1) {
486  qint16 w, h;
487  s >> w; sz.rwidth() = w;
488  s >> h; sz.rheight() = h;
489  }
490  else {
491  qint32 w, h;
492  s >> w; sz.rwidth() = w;
493  s >> h; sz.rheight() = h;
494  }
495  return s;
496 }
int qint32
Definition: qglobal.h:937
short qint16
Definition: qglobal.h:935

Properties

◆ ht

int QSize::ht
private

◆ wd

int QSize::wd
private

The documentation for this class was generated from the following files: