Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QPoint Class Reference

\inmodule QtCore\reentrant More...

#include <qpoint.h>

+ Collaboration diagram for QPoint:

Public Member Functions

constexpr QPoint () noexcept
 Constructs a null point, i.e.
 
constexpr QPoint (int xpos, int ypos) noexcept
 Constructs a point with the given coordinates (xpos, ypos).
 
constexpr bool isNull () const noexcept
 Returns true if both the x and y coordinates are set to 0, otherwise returns false.
 
constexpr int x () const noexcept
 Returns the x coordinate of this point.
 
constexpr int y () const noexcept
 Returns the y coordinate of this point.
 
constexpr void setX (int x) noexcept
 Sets the x coordinate of this point to the given x coordinate.
 
constexpr void setY (int y) noexcept
 Sets the y coordinate of this point to the given y coordinate.
 
constexpr int manhattanLength () const
 Returns the sum of the absolute values of x() and y(), traditionally known as the "Manhattan length" of the vector from the origin to the point.
 
constexpr QPoint transposed () const noexcept
 
constexpr int & rx () noexcept
 Returns a reference to the x coordinate of this point.
 
constexpr int & ry () noexcept
 Returns a reference to the y coordinate of this point.
 
constexpr QPointoperator+= (const QPoint &p)
 Adds the given point to this point and returns a reference to this point.
 
constexpr QPointoperator-= (const QPoint &p)
 Subtracts the given point from this point and returns a reference to this point.
 
constexpr QPointoperator*= (float factor)
 Multiplies this point's coordinates by the given factor, and returns a reference to this point.
 
constexpr QPointoperator*= (double factor)
 Multiplies this point's coordinates by the given factor, and returns a reference to this point.
 
constexpr QPointoperator*= (int factor)
 Multiplies this point's coordinates by the given factor, and returns a reference to this point.
 
constexpr QPointoperator/= (qreal divisor)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Divides both x and y by the given divisor, and returns a reference to this point.
 
constexpr QPointF toPointF () const noexcept
 

Static Public Member Functions

static constexpr int dotProduct (const QPoint &p1, const QPoint &p2)
 

Friends

class QTransform
 
constexpr bool operator== (const QPoint &p1, const QPoint &p2) noexcept
 Returns true if p1 and p2 are equal; otherwise returns false.
 
constexpr bool operator!= (const QPoint &p1, const QPoint &p2) noexcept
 Returns true if p1 and p2 are not equal; otherwise returns false.
 
constexpr QPoint operator+ (const QPoint &p1, const QPoint &p2) noexcept
 Returns a QPoint object that is the sum of the given points, p1 and p2; each component is added separately.
 
constexpr QPoint operator- (const QPoint &p1, const QPoint &p2) noexcept
 Returns a QPoint object that is formed by subtracting p2 from p1; each component is subtracted separately.
 
constexpr QPoint operator* (const QPoint &p, float factor)
 Returns a copy of the given point multiplied by the given factor.
 
constexpr QPoint operator* (const QPoint &p, double factor)
 Returns a copy of the given point multiplied by the given factor.
 
constexpr QPoint operator* (const QPoint &p, int factor) noexcept
 Returns a copy of the given point multiplied by the given factor.
 
constexpr QPoint operator* (float factor, const QPoint &p)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a copy of the given point multiplied by the given factor.
 
constexpr QPoint operator* (double factor, const QPoint &p)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a copy of the given point multiplied by the given factor.
 
constexpr QPoint operator* (int factor, const QPoint &p) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a copy of the given point multiplied by the given factor.
 
constexpr QPoint operator+ (const QPoint &p) noexcept
 
constexpr QPoint operator- (const QPoint &p) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QPoint object that is formed by changing the sign of both components of the given point.
 
constexpr QPoint operator/ (const QPoint &p, qreal c)
 Returns the QPoint formed by dividing both components of the given point by the given divisor.
 
template<std::size_t I, typename P , std::enable_if_t<(I< 2), bool > = true, std::enable_if_t< std::is_same_v< q20::remove_cvref_t< P >, QPoint >, bool > = true>
constexpr decltype(auto) get (P &&p) noexcept
 

Related Symbols

(Note that these are not member symbols.)

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

Detailed Description

\inmodule QtCore

\reentrant

The QPoint class defines a point in the plane using integer precision.

A point is specified by a x coordinate and an y coordinate which can be accessed using the x() and y() functions. The isNull() function returns true if both x and y are set to 0. The coordinates can be set (or altered) using the setX() and setY() functions, or alternatively the rx() and ry() functions which return references to the coordinates (allowing direct manipulation).

Given a point p, the following statements are all equivalent:

p.setX(p.x() + 1);
p += QPoint(1, 0);
p.rx()++;

A QPoint object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added separately). A QPoint object can also be divided or multiplied by an int or a qreal.

In addition, the QPoint class provides the manhattanLength() function which gives an inexpensive approximation of the length of the QPoint object interpreted as a vector. Finally, QPoint objects can be streamed as well as compared.

See also
QPointF, QPolygon

Definition at line 22 of file qpoint.h.

Constructor & Destructor Documentation

◆ QPoint() [1/2]

constexpr QPoint::QPoint ( )
inlineconstexprnoexcept

Constructs a null point, i.e.

with coordinates (0, 0)

See also
isNull()

Definition at line 118 of file qpoint.h.

◆ QPoint() [2/2]

constexpr QPoint::QPoint ( int xpos,
int ypos )
inlineconstexprnoexcept

Constructs a point with the given coordinates (xpos, ypos).

See also
setX(), setY()

Definition at line 120 of file qpoint.h.

Member Function Documentation

◆ dotProduct()

static int QPoint::dotProduct ( const QPoint & p1,
const QPoint & p2 )
inlinestaticconstexpr
Since
5.1
QPoint p( 3, 7);
QPoint q(-1, 4);
int dotProduct = QPoint::dotProduct(p, q); // dotProduct becomes 25

Returns the dot product of p1 and p2.

Definition at line 51 of file qpoint.h.

References p1, and p2.

◆ isNull()

constexpr bool QPoint::isNull ( ) const
inlineconstexprnoexcept

Returns true if both the x and y coordinates are set to 0, otherwise returns false.

Definition at line 122 of file qpoint.h.

Referenced by QGraphicsViewPrivate::canStartScrollingAt(), QRhiD3D11::enqueueSubresUpload(), QRhiGles2::enqueueSubresUpload(), QRhiMetal::enqueueSubresUpload(), QWindowSystemInterface::handleWheelEvent(), QRhiVulkan::prepareUploadSubres(), QWaylandSurfacePrivate::surface_commit(), and QTest::wheelEvent().

+ Here is the caller graph for this function:

◆ manhattanLength()

int constexpr QPoint::manhattanLength ( ) const
inlineconstexpr

Returns the sum of the absolute values of x() and y(), traditionally known as the "Manhattan length" of the vector from the origin to the point.

For example:

{
QPoint point = event->pos() - oldPosition;
if (point.manhattanLength() > 3)
// the mouse has moved more than 3 pixels since the oldPosition
}

This is a useful, and quick to calculate, approximation to the true length:

The tradition of "Manhattan length" arises because such distances apply to travelers who can only travel on a rectangular grid, like the streets of Manhattan.

Definition at line 147 of file qpoint.h.

References qAbs().

Referenced by moveToVirtualScreen(), QTapGestureRecognizer::recognize(), and QTapAndHoldGestureRecognizer::recognize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator*=() [1/3]

constexpr QPoint & QPoint::operator*= ( double factor)
inlineconstexpr

Multiplies this point's coordinates by the given factor, and returns a reference to this point.

For example:

QPoint p(-1, 4);
p *= 2.5; // p becomes (-3, 10)

Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

See also
operator/=()

Definition at line 183 of file qpoint.h.

References qRound().

+ Here is the call graph for this function:

◆ operator*=() [2/3]

constexpr QPoint & QPoint::operator*= ( float factor)
inlineconstexpr

Multiplies this point's coordinates by the given factor, and returns a reference to this point.

Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

See also
operator/=()

Definition at line 176 of file qpoint.h.

References qRound().

+ Here is the call graph for this function:

◆ operator*=() [3/3]

constexpr QPoint & QPoint::operator*= ( int factor)
inlineconstexpr

Multiplies this point's coordinates by the given factor, and returns a reference to this point.

See also
operator/=()

Definition at line 190 of file qpoint.h.

◆ operator+=()

constexpr QPoint & QPoint::operator+= ( const QPoint & point)
inlineconstexpr

Adds the given point to this point and returns a reference to this point.

For example:

QPoint p( 3, 7);
QPoint q(-1, 4);
p += q; // p becomes (2, 11)
See also
operator-=()

Definition at line 162 of file qpoint.h.

◆ operator-=()

constexpr QPoint & QPoint::operator-= ( const QPoint & point)
inlineconstexpr

Subtracts the given point from this point and returns a reference to this point.

For example:

QPoint p( 3, 7);
QPoint q(-1, 4);
p -= q; // p becomes (4, 3)
See also
operator+=()

Definition at line 169 of file qpoint.h.

◆ operator/=()

constexpr QPoint & QPoint::operator/= ( qreal divisor)
inlineconstexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Divides both x and y by the given divisor, and returns a reference to this point.

For example:

QPoint p(-3, 10);
p /= 2.5; // p becomes (-1, 4)

Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

See also
operator*=()

Definition at line 197 of file qpoint.h.

References qRound().

+ Here is the call graph for this function:

◆ rx()

constexpr int & QPoint::rx ( )
inlineconstexprnoexcept

Returns a reference to the x coordinate of this point.

Using a reference makes it possible to directly manipulate x. For example:

QPoint p(1, 2);
p.rx()--; // p becomes (0, 2)
See also
x(), setX()

Definition at line 152 of file qpoint.h.

Referenced by QWidgetResizeHandler::keyPressEvent(), QGraphicsView::mapToScene(), QWidgetResizeHandler::mouseMoveEvent(), QQuickTableViewPrivate::normalizeSelection(), operator>>(), and QMenuPrivate::popup().

+ Here is the caller graph for this function:

◆ ry()

constexpr int & QPoint::ry ( )
inlineconstexprnoexcept

Returns a reference to the y coordinate of this point.

Using a reference makes it possible to directly manipulate y. For example:

QPoint p(1, 2);
p.ry()++; // p becomes (1, 3)
See also
y(), setY()

Definition at line 157 of file qpoint.h.

Referenced by QKmsDevice::createScreens(), QWidgetResizeHandler::keyPressEvent(), QWidgetResizeHandler::mouseMoveEvent(), QQuickTableViewPrivate::normalizeSelection(), and operator>>().

+ Here is the caller graph for this function:

◆ setX()

constexpr void QPoint::setX ( int x)
inlineconstexprnoexcept

◆ setY()

constexpr void QPoint::setY ( int y)
inlineconstexprnoexcept

Sets the y coordinate of this point to the given y coordinate.

See also
y(), setX()

Definition at line 142 of file qpoint.h.

Referenced by QWindowGeometrySpecification::applyTo(), QXcbWindow::handleButtonPressEvent(), QAndroidInputContext::handleLocationChanged(), QTabBarPrivate::layoutTab(), HIDDeviceHandler::process_event(), QLibInputPointer::processAbsMotion(), QLibInputPointer::processAxis(), QLibInputPointer::processMotion(), QEvdevMouseHandler::readMouseData(), QPlatformCursorImage::set(), QPlatformCursorImage::set(), and QLibInputPointer::setPos().

+ Here is the caller graph for this function:

◆ toPointF()

constexpr QPointF QPoint::toPointF ( ) const
inlineconstexprnoexcept
Since
6.4

Returns this point as a point with floating point accuracy.

See also
QPointF::toPoint()

Definition at line 392 of file qpoint.h.

◆ transposed()

QPoint::transposed ( ) const
inlineconstexprnoexcept
Since
5.14

Returns a point with x and y coordinates exchanged:

QPoint{1, 2}.transposed() // {2, 1}
\inmodule QtCore\reentrant
Definition qpoint.h:23
constexpr QPoint transposed() const noexcept
Definition qpoint.h:37
See also
x(), y(), setX(), setY()

Definition at line 37 of file qpoint.h.

Referenced by QXcbWindow::handleButtonPressEvent().

+ Here is the caller graph for this function:

◆ x()

constexpr int QPoint::x ( ) const
inlineconstexprnoexcept

Returns the x coordinate of this point.

See also
setX(), rx()

Definition at line 127 of file qpoint.h.

Referenced by QtWaylandClient::QWaylandWindow::attachOffset(), QQuickTableViewPrivate::TableEdgeLoadRequest::begin(), QPainter::begin(), QPolygon::boundingRect(), calcPosition(), QQuickTableViewPrivate::cellIsValid(), QLine::center(), QLineF::center(), QDirectFBCursor::changeCursor(), QEglFSKmsGbmCursor::changeCursor(), QWindowsOleDropSource::createCursors(), QWindowsCursor::createPixmapCursor(), QLineEdit::cursorPositionAt(), dockPosHelper(), QWidgetResizeHandler::doResize(), QXcbWindow::doStartSystemMoveResize(), QCocoaDrag::drag(), QMacStyle::drawControl(), QX11PaintEngine::drawPoints(), drawTextItemDecoration(), QLine::dx(), QLineF::dx(), QRhiVulkan::enqueueResourceUpdates(), QRhiMetal::enqueueSubresUpload(), QXcbDrag::findXdndAwareTarget(), QBackingStore::flush(), QGraphicsScenePrivate::gestureEventHandler(), QScreen::grabWindow(), QQuickTableViewHoverHandler::handleEventPoint(), QWindowsWindow::handleNonClientHitTest(), QWindowSystemInterface::handleWheelEvent(), QQC2_NAMESPACE::QMacStyle::hitTestComplexControl(), QMacStyle::hitTestComplexControl(), QTreeView::indexAt(), QToolBarPrivate::initDrag(), QWidgetPrivate::invalidateBackingStore_resizeHelper(), QLineF::isNull(), QQuickTableViewPrivate::layoutTopLeftItem(), QQuickVisualTestUtils::lerpPoints(), QQuickTableViewPrivate::loadInitialTable(), makeDistanceField(), QTransform::map(), QMatrix4x4::map(), QTransform::map(), QMatrix4x4::mapRect(), QDoubleMatrix4x4::mapRect(), QPlainTextEditPrivate::mapToContents(), QTextEditPrivate::mapToContents(), mapToGlobalTransform(), QQuickTreeView::modelIndex(), QQuickTableViewPrivate::modelIndexAtCell(), QScrollBar::mouseMoveEvent(), QToolBarPrivate::mouseMoveEvent(), QWidgetResizeHandler::mouseMoveEvent(), QtPrivate::QColorWell::mouseMoveEvent(), QComboBoxPrivateScroller::mouseMoveEvent(), QDockWidgetPrivate::mouseMoveEvent(), QGraphicsView::mouseMoveEvent(), QtPrivate::QWellArray::mousePressEvent(), QScrollBar::mousePressEvent(), QXcbDrag::move(), QAbstractButtonPrivate::moveFocus(), QQuickTableViewPrivate::normalizeSelection(), operator<<(), QCursor::operator>>(), QtPrivate::QColorPicker::paintEvent(), QSliderPrivate::pick(), QImage::pixel(), QImage::pixelColor(), QImage::pixelIndex(), QMdiAreaPrivate::place(), QLineF::pointAt(), QQuickTableView::positionViewAtCell(), QRhiVulkan::prepareUploadSubres(), HIDDeviceHandler::process_event(), QLibInputPointer::processMotion(), qt_gtk_menu_position_func(), QEglFSKmsScreen::rawGeometry(), QMdi::IconTiler::rearrange(), QDockWidgetPrivate::recalculatePressPos(), QQuickTableViewPrivate::selection(), QWaylandOutputPrivate::sendGeometry(), QQuickTableViewPrivate::setCurrentIndexFromKeyEvent(), dom::DataTransfer::setDragImage(), QWidgetPrivate::setGeometry_sys(), QLineF::setLength(), QMdiSubWindowPrivate::setNewGeometry(), QHeaderView::setOffset(), QXcbWindow::setParent(), QImage::setPixel(), QImage::setPixelColor(), QPolygon::setPoint(), QEglFSKmsGbmCursor::setPos(), QWindowsCursor::setPos(), QXcbCursor::setPos(), QCocoaCursor::setPos(), QSGDefaultSpriteNode::setSheetSize(), QOpenGLShaderProgram::setUniformValue(), QComboBox::showPopup(), QWindowsPopupMenu::showPopup(), QMenu::showTearOffMenu(), QWaylandSurfacePrivate::surface_commit(), glyph_metrics_t::transformed(), QWindowsPointerHandler::translateMouseEvent(), QColorDialogPrivate::updateColorLabelText(), QQuickTableViewPrivate::updateCurrentRowAndColumn(), QtAndroidInput::updateHandles(), QQuickTreeViewPrivate::updateRequiredProperties(), QtWaylandClient::QWaylandEglWindow::updateSurface(), QStyle::visualPos(), QQC2::QStyle::visualPos(), QWindowsSystemTrayIcon::winEvent(), QLine::x1(), QLineF::x1(), QLine::x2(), QLineF::x2(), and QWaylandXdgOutputV1Private::zxdg_output_v1_bind_resource().

◆ y()

constexpr int QPoint::y ( ) const
inlineconstexprnoexcept

Returns the y coordinate of this point.

See also
setY(), ry()

Definition at line 132 of file qpoint.h.

Referenced by QtWaylandClient::QWaylandWindow::attachOffset(), QQuickTableViewPrivate::TableEdgeLoadRequest::begin(), QPainter::begin(), QPolygon::boundingRect(), calcPosition(), QQuickTableViewPrivate::cellIsValid(), QLine::center(), QLineF::center(), QDirectFBCursor::changeCursor(), QEglFSKmsGbmCursor::changeCursor(), convolute(), QSizeGripPrivate::corner(), QWindowsOleDropSource::createCursors(), QWindowsCursor::createPixmapCursor(), QWidgetResizeHandler::doResize(), QXcbWindow::doStartSystemMoveResize(), QCocoaDrag::drag(), QTreeView::drawRow(), QLine::dy(), QLineF::dy(), QRhiVulkan::enqueueResourceUpdates(), QRhiMetal::enqueueSubresUpload(), QXcbDrag::findXdndAwareTarget(), QBackingStore::flush(), QGraphicsScenePrivate::gestureEventHandler(), QScreen::grabWindow(), QQuickTableViewHoverHandler::handleEventPoint(), QAndroidInputContext::handleLocationChanged(), QWindowsWindow::handleNonClientHitTest(), QWindowSystemInterface::handleWheelEvent(), QQC2_NAMESPACE::QMacStyle::hitTestComplexControl(), QMacStyle::hitTestComplexControl(), QTreeView::indexAt(), QToolBarPrivate::initDrag(), QWidgetPrivate::invalidateBackingStore_resizeHelper(), QLineF::isNull(), QQuickTreeView::keyPressEvent(), QQuickTableViewPrivate::layoutTopLeftItem(), QQuickVisualTestUtils::lerpPoints(), QQuickTableViewPrivate::loadInitialTable(), makeDistanceField(), QMatrix4x4::map(), QMatrix4x4::mapRect(), QDoubleMatrix4x4::mapRect(), QPlainTextEditPrivate::mapToContents(), QTextEditPrivate::mapToContents(), mapToGlobalTransform(), QQuickTreeView::modelIndex(), QQuickTableViewPrivate::modelIndexAtCell(), QScrollBar::mouseMoveEvent(), QToolBarPrivate::mouseMoveEvent(), QWidgetResizeHandler::mouseMoveEvent(), QtPrivate::QColorWell::mouseMoveEvent(), QComboBoxPrivateScroller::mouseMoveEvent(), QGraphicsView::mouseMoveEvent(), QtPrivate::QWellArray::mousePressEvent(), QScrollBar::mousePressEvent(), QXcbDrag::move(), QAbstractButtonPrivate::moveFocus(), QQuickTableViewPrivate::normalizeSelection(), operator<<(), QCursor::operator>>(), QtPrivate::QColorPicker::paintEvent(), QSliderPrivate::pick(), QImage::pixel(), QImage::pixelColor(), QImage::pixelIndex(), QMdiAreaPrivate::place(), QTipLabel::placeTip(), QLineF::pointAt(), QQuickTableView::positionViewAtCell(), QRhiVulkan::prepareUploadSubres(), HIDDeviceHandler::process_event(), QLibInputPointer::processMotion(), qt_gtk_menu_position_func(), QEglFSKmsScreen::rawGeometry(), QMdi::IconTiler::rearrange(), QQuickTableViewPrivate::selection(), QQuickTableViewPrivate::selectionRectangle(), QWaylandOutputPrivate::sendGeometry(), QQuickTableViewPrivate::setCurrentIndexFromKeyEvent(), dom::DataTransfer::setDragImage(), QWidgetPrivate::setGeometry_sys(), QLineF::setLength(), QMdiSubWindowPrivate::setNewGeometry(), QHeaderView::setOffset(), QXcbWindow::setParent(), QImage::setPixel(), QImage::setPixelColor(), QPolygon::setPoint(), QEglFSKmsGbmCursor::setPos(), QWindowsCursor::setPos(), QXcbCursor::setPos(), QCocoaCursor::setPos(), QSplitter::setRubberBand(), QSGDefaultSpriteNode::setSheetSize(), QOpenGLShaderProgram::setUniformValue(), QComboBox::showPopup(), QCocoaMenu::showPopup(), QWindowsPopupMenu::showPopup(), QMenu::showTearOffMenu(), QColorDialogPrivate::updateColorLabelText(), QQuickTableViewPrivate::updateCurrentRowAndColumn(), QtAndroidInput::updateHandles(), QTabBarPrivate::updateMacBorderMetrics(), QToolBarLayout::updateMacBorderMetrics(), QQuickTreeViewPrivate::updateRequiredProperties(), QtWaylandClient::QWaylandEglWindow::updateSurface(), QStyle::visualPos(), QQC2::QStyle::visualPos(), QWindowsSystemTrayIcon::winEvent(), QLine::y1(), QLineF::y1(), QLine::y2(), QLineF::y2(), and QWaylandXdgOutputV1Private::zxdg_output_v1_bind_resource().

Friends And Related Symbol Documentation

◆ get

template<std::size_t I, typename P , std::enable_if_t<(I< 2), bool > = true, std::enable_if_t< std::is_same_v< q20::remove_cvref_t< P >, QPoint >, bool > = true>
constexpr decltype(auto) get ( P && p)
friend

Definition at line 95 of file qpoint.h.

◆ operator!=

bool QPoint::operator!= ( const QPoint & p1,
const QPoint & p2 )
friend

Returns true if p1 and p2 are not equal; otherwise returns false.

Definition at line 56 of file qpoint.h.

◆ operator* [1/6]

QPoint QPoint::operator* ( const QPoint & point,
double factor )
friend

Returns a copy of the given point multiplied by the given factor.

Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

See also
QPoint::operator*=()

Definition at line 64 of file qpoint.h.

◆ operator* [2/6]

QPoint QPoint::operator* ( const QPoint & point,
float factor )
friend

Returns a copy of the given point multiplied by the given factor.

Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

See also
QPoint::operator*=()

Definition at line 62 of file qpoint.h.

◆ operator* [3/6]

QPoint QPoint::operator* ( const QPoint & point,
int factor )
friend

Returns a copy of the given point multiplied by the given factor.

See also
QPoint::operator*=()

Definition at line 66 of file qpoint.h.

◆ operator* [4/6]

QPoint QPoint::operator* ( double factor,
const QPoint & point )
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a copy of the given point multiplied by the given factor.

Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

See also
QPoint::operator*=()

Definition at line 70 of file qpoint.h.

◆ operator* [5/6]

QPoint QPoint::operator* ( float factor,
const QPoint & point )
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a copy of the given point multiplied by the given factor.

Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

See also
QPoint::operator*=()

Definition at line 68 of file qpoint.h.

◆ operator* [6/6]

QPoint QPoint::operator* ( int factor,
const QPoint & point )
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a copy of the given point multiplied by the given factor.

See also
QPoint::operator*=()

Definition at line 72 of file qpoint.h.

◆ operator+ [1/2]

QPoint QPoint::operator+ ( const QPoint & point)
friend
Since
5.0

Returns point unmodified.

Definition at line 74 of file qpoint.h.

◆ operator+ [2/2]

QPoint QPoint::operator+ ( const QPoint & p1,
const QPoint & p2 )
friend

Returns a QPoint object that is the sum of the given points, p1 and p2; each component is added separately.

See also
QPoint::operator+=()

Definition at line 58 of file qpoint.h.

◆ operator- [1/2]

QPoint QPoint::operator- ( const QPoint & point)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QPoint object that is formed by changing the sign of both components of the given point.

Equivalent to {QPoint(0,0) - point}.

Definition at line 76 of file qpoint.h.

◆ operator- [2/2]

Point QPoint::operator- ( const QPoint & p1,
const QPoint & p2 )
friend

Returns a QPoint object that is formed by subtracting p2 from p1; each component is subtracted separately.

See also
QPoint::operator-=()

Definition at line 60 of file qpoint.h.

◆ operator/

const QPoint QPoint::operator/ ( const QPoint & point,
qreal divisor )
friend

Returns the QPoint formed by dividing both components of the given point by the given divisor.

Note that the result is rounded to the nearest integer as points are held as integers. Use QPointF for floating point accuracy.

See also
QPoint::operator/=()

Definition at line 78 of file qpoint.h.

◆ operator<<()

QDataStream & operator<< ( QDataStream & stream,
const QPoint & point )
related

Writes the given point to the given stream and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 371 of file qpoint.cpp.

◆ operator==

bool QPoint::operator== ( const QPoint & p1,
const QPoint & p2 )
friend

Returns true if p1 and p2 are equal; otherwise returns false.

Definition at line 54 of file qpoint.h.

◆ operator>>()

QDataStream & operator>> ( QDataStream & stream,
QPoint & point )
related

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

See also
{Serializing Qt Data Types}

Definition at line 390 of file qpoint.cpp.

◆ QTransform

friend class QTransform
friend

Definition at line 87 of file qpoint.h.


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