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

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

#include <qpoint.h>

Public Functions

bool isNull () const
 Returns true if both the x and y coordinates are set to 0, otherwise returns false. More...
 
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. More...
 
QPointoperator*= (float c)
 
QPointoperator*= (double c)
 
QPointoperator*= (int c)
 
QPointoperator+= (const QPoint &p)
 Adds the given point to this point and returns a reference to this point. More...
 
QPointoperator-= (const QPoint &p)
 Subtracts the given point from this point and returns a reference to this point. More...
 
QPointoperator/= (qreal c)
 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. More...
 
 QPoint ()
 Constructs a null point, i. More...
 
 QPoint (int xpos, int ypos)
 Constructs a point with the given coordinates (x, y). More...
 
int & rx ()
 Returns a reference to the x coordinate of this point. More...
 
int & ry ()
 Returns a reference to the y coordinate of this point. More...
 
void setX (int x)
 Sets the x coordinate of this point to the given x coordinate. More...
 
void setY (int y)
 Sets the y coordinate of this point to the given y coordinate. More...
 
int x () const
 Returns the x coordinate of this point. More...
 
int y () const
 Returns the y coordinate of this point. More...
 

Properties

int xp
 
int yp
 

Friends

bool operator!= (const QPoint &, const QPoint &)
 Returns true if p1 and p2 are not equal; otherwise returns false. More...
 
const QPoint operator* (const QPoint &, float)
 
const QPoint operator* (float, const QPoint &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
const QPoint operator* (const QPoint &, double)
 
const QPoint operator* (double, const QPoint &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
const QPoint operator* (const QPoint &, int)
 
const QPoint operator* (int, const QPoint &)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
const QPoint operator+ (const QPoint &, const QPoint &)
 Returns a QPoint object that is the sum of the given points, p1 and p2; each component is added separately. More...
 
const QPoint operator- (const QPoint &, const QPoint &)
 Returns a QPoint object that is formed by subtracting p2 from p1; each component is subtracted separately. More...
 
const QPoint operator- (const QPoint &)
 Returns a QPoint object that is formed by changing the sign of both components of the given point. More...
 
const QPoint operator/ (const QPoint &, qreal)
 Returns the QPoint formed by dividing both components of the given point by the given divisor. More...
 
bool operator== (const QPoint &, const QPoint &)
 Returns true if p1 and p2 are equal; otherwise returns false. More...
 
class QTransform
 

Related Functions

(Note that these are not member functions.)

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

Detailed Description

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 53 of file qpoint.h.

Constructors and Destructors

◆ QPoint() [1/2]

QPoint::QPoint ( )
inline

Constructs a null point, i.

e. with coordinates (0, 0)

\sa isNull()

Definition at line 119 of file qpoint.h.

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

120 { xp=0; yp=0; }
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

◆ QPoint() [2/2]

QPoint::QPoint ( int  x,
int  y 
)
inline

Constructs a point with the given coordinates (x, y).

See also
setX(), setY()

Definition at line 122 of file qpoint.h.

123 { xp = xpos; yp = ypos; }
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

Functions

◆ isNull()

bool QPoint::isNull ( ) const
inline

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

Definition at line 125 of file qpoint.h.

Referenced by QVGCompositionHelper::blitWindow(), QX11WindowSurface::flush(), QRasterWindowSurface::flush(), getNetWmState(), QWidgetPrivate::invalidateBuffer_resizeHelper(), make_widget_eventUPP(), QTest::mouseEvent(), and QSwipeGestureRecognizer::recognize().

126 { return xp == 0 && yp == 0; }
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

◆ manhattanLength()

int QPoint::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.

For example:

QPoint oldPosition;
MyWidget::mouseMoveEvent(QMouseEvent *event)
{
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:

double trueLength = sqrt(pow(x(), 2) + pow(y(), 2));

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 489 of file qpoint.cpp.

Referenced by QComboBoxPrivateContainer::eventFilter(), QAbstractScrollAreaPrivate::layoutChildren(), QmlJSDebugger::LiveSelectionTool::mouseMoveEvent(), QmlJSDebugger::LiveSelectionTool::mouseReleaseEvent(), QTapGestureRecognizer::recognize(), and QTapAndHoldGestureRecognizer::recognize().

490 {
491  return qAbs(x())+qAbs(y());
492 }
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128

◆ operator*=() [1/3]

QPoint & QPoint::operator*= ( float  factor)
inline
Since
4.8

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 152 of file qpoint.h.

153 { xp = qRound(xp*c); yp = qRound(yp*c); return *this; }
unsigned char c[8]
Definition: qnumeric_p.h:62
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator*=() [2/3]

QPoint & QPoint::operator*= ( double  factor)
inline
Since
4.8

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 155 of file qpoint.h.

156 { xp = qRound(xp*c); yp = qRound(yp*c); return *this; }
unsigned char c[8]
Definition: qnumeric_p.h:62
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator*=() [3/3]

QPoint & QPoint::operator*= ( int  factor)
inline
Since
4.8

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

See also
operator/=()

Definition at line 158 of file qpoint.h.

159 { xp = xp*c; yp = yp*c; return *this; }
unsigned char c[8]
Definition: qnumeric_p.h:62
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

◆ operator+=()

QPoint & QPoint::operator+= ( const QPoint point)
inline

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 146 of file qpoint.h.

147 { xp+=p.xp; yp+=p.yp; return *this; }
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

◆ operator-=()

QPoint & QPoint::operator-= ( const QPoint point)
inline

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 149 of file qpoint.h.

150 { xp-=p.xp; yp-=p.yp; return *this; }
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

◆ operator/=()

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

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 194 of file qpoint.h.

195 {
196  xp = qRound(xp/c);
197  yp = qRound(yp/c);
198  return *this;
199 }
unsigned char c[8]
Definition: qnumeric_p.h:62
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ rx()

int & QPoint::rx ( )
inline

◆ ry()

int & QPoint::ry ( )
inline

◆ setX()

void QPoint::setX ( int  x)
inline

◆ setY()

void QPoint::setY ( int  y)
inline

◆ x()

int QPoint::x ( ) const
inline

Returns the x coordinate of this point.

See also
setX(), rx()

Definition at line 128 of file qpoint.h.

Referenced by QPushButtonPrivate::adjustedMenuPosition(), QDialog::adjustPosition(), QPainterPrivate::attachPainterPrivate(), QBalloonTip::balloon(), QPainter::begin(), blendCursor(), QAhiScreen::blit(), blit180(), blit270(), blit90(), blit_template(), QPolygon::boundingRect(), QWSCalibratedMouseHandler::calibrate(), QDirectFBCursor::changeCursor(), QPlatformSoftwareCursor::changeCursor(), QAccessibleWidget::childAt(), QAccessibleComboBox::childAt(), QAccessibleMainWindow::childAt(), clipStraightLine(), QListViewPrivate::closestIndex(), QScreen::compose(), QOpenGLPaintEnginePrivate::composite(), QRegion::contains(), QRect::contains(), QScrollBar::contextMenuEvent(), QAbstractSpinBox::contextMenuEvent(), convolute(), QSizeGripPrivate::corner(), QXlibCursor::createCursorBitmap(), QOleDropSource::createCursors(), CreateETandAET(), QDirectFBScreen::createSurface(), QLineEdit::cursorPositionAt(), QToolBarAreaLayoutInfo::distance(), QAbstractItemView::doAutoScroll(), dockPosHelper(), QIconModeViewBase::doDynamicLayout(), QWidgetResizeHandler::doResize(), QListModeViewBase::doStaticLayout(), QDragManager::drag(), QLineEdit::dragMoveEvent(), QListModeViewBase::dragMoveEvent(), QColorWell::dragMoveEvent(), QGraphicsOpacityEffect::draw(), QRenderRule::drawBackgroundImage(), QWindowsVistaStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QVGCompositionHelper::drawCursorPixmap(), QPainter::drawEllipse(), QX11PaintEngine::drawFreetype(), QPainter::drawImage(), QPainter::drawPixmap(), QX11PaintEngine::drawPoints(), QOpenGLPaintEngine::drawPoints(), QVGPaintEngine::drawPoints(), QPaintEngine::drawPoints(), QPaintEngineEx::drawPoints(), drawPoints(), QVGPaintEngine::drawPolygon(), QOpenGLPaintEngine::drawPolygon(), QPaintEngine::drawPolygon(), QPaintBufferEngine::drawPolygon(), QCommonStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QTreeView::drawRow(), QWindowsMobileStylePrivate::drawScrollbarGrip(), drawTextItemDecoration(), QLineEdit::dropEvent(), QColorWell::dropEvent(), QListModeViewBase::dropOn(), QLine::dx(), effectiveState(), QPlainTextEditPrivate::ensureCursorVisible(), QScrollArea::ensureWidgetVisible(), QMdiSubWindowPrivate::enterRubberBandMode(), QDockWidget::event(), QScriptEdit::extraAreaMouseEvent(), QIconModeViewBase::filterDropEvent(), QX11Data::findClientWindow(), findRealWindow(), QSystemTrayIconSys::findTrayGeometry(), flipPoint(), QDirectFBScreen::flipSurface(), QListViewPrivate::flipX(), QDirectFbWindowSurface::flush(), QX11WindowSurface::flush(), QRasterWindowSurface::flush(), QGraphicsScenePrivate::gestureEventHandler(), QWSCalibratedMouseHandler::getCalibration(), QPlatformSoftwareCursor::getCurrentRect(), QMacInputContext::globalEventProcessor(), QApplicationPrivate::globalEventProcessor(), QPixmap::grabWindow(), QBBScreenEventHandler::handlePointerEvent(), handlePositionAttribute(), QBBScreenEventHandler::handleTouchEvent(), QCommonStyle::hitTestComplexControl(), QMacStyle::hitTestComplexControl(), QColorPicker::huePt(), QColumnView::indexAt(), QTableView::indexAt(), QListView::indexAt(), QTreeView::indexAt(), QListModeViewBase::indexToListViewItem(), QBspTree::init(), QToolBarPrivate::initDrag(), QTriangulator< T >::initialize(), QBBScreenEventHandler::injectPointerMoveEvent(), QMainWindowLayout::insertIntoMacToolbar(), QMenu::internalDelayedPopup(), QWidgetPrivate::invalidateBuffer_resizeHelper(), QWidgetPrivate::isBackgroundInherited(), isServerProcess(), QTreeViewPrivate::itemDecorationAt(), Q3AccessibleTextEdit::itemRect(), QGraphicsView::items(), QWidgetResizeHandler::keyPressEvent(), QAbstractScrollAreaPrivate::layoutChildren(), QTabBarPrivate::layoutTab(), QApplicationPrivate::leaveModal_sys(), QWSMouseHandler::limitToScreen(), QHeaderView::logicalIndexAt(), make_widget_eventUPP(), manhattanLength(), QPointF::manhattanLength(), QMatrix::map(), QTransform::map(), QTransformedScreen::mapFromDevice(), QWidget::mapFromGlobal(), QWidgetPrivate::mapFromGlobal(), QMatrix4x4::mapRect(), QTextEditPrivate::mapToContents(), QPlainTextEditPrivate::mapToContents(), QTransformedScreen::mapToDevice(), QWidget::mapToGlobal(), QWidgetPrivate::mapToGlobal(), QLineEdit::mouseDoubleClickEvent(), QMenuPrivate::mouseEventTaken(), QScrollBar::mouseMoveEvent(), QWidgetResizeHandler::mouseMoveEvent(), QToolBarPrivate::mouseMoveEvent(), QVistaHelper::mouseMoveEvent(), QComboBoxPrivateScroller::mouseMoveEvent(), QLineEdit::mouseMoveEvent(), QGraphicsView::mouseMoveEvent(), QWorkspaceTitleBar::mouseMoveEvent(), QSizeGrip::mousePressEvent(), QScrollBar::mousePressEvent(), QWellArray::mousePressEvent(), QLineEdit::mousePressEvent(), QMultiScreenCursor::move(), QRubberBand::move(), QListViewItem::move(), QWidget::move(), QDirectFBScreenCursor::move(), QRect::moveBottomLeft(), QRect::moveBottomRight(), QRect::moveCenter(), QAbstractButtonPrivate::moveFocus(), QRect::moveTo(), QRect::moveTopLeft(), QRect::moveTopRight(), QAccessibleWidget::navigate(), operator*(), operator<<(), operator>>(), QTableView::paintEvent(), QColorPicker::paintEvent(), perp(), pick(), QSliderPrivate::pick(), QSplitterPrivate::pick(), QSplitterHandlePrivate::pick(), QmlJSDebugger::ColorPickerTool::pickColor(), QImage::pixel(), QImage::pixelIndex(), QMdiAreaPrivate::place(), QTipLabel::placeTip(), QPolygon::point(), QWidgetPrivate::pointToRect(), PolygonRegion(), QMenu::popup(), QMenuBarPrivate::popupAction(), QToolButtonPrivate::popupTimerDone(), QListModeViewBase::position(), QDateTimeEditPrivate::positionCalendarPopup(), QLineControl::processMouseEvent(), PtsToRegion(), QXcbShmImage::put(), PvrEglWindowSurface::PvrEglWindowSurface(), q_createNativeChildrenAndSetParent(), qDrawShadeLine(), QRect::QRect(), qstring_to_xtp(), qt_bitmapToRegion(), qt_cleanlooks_draw_buttongradient(), qt_cleanlooks_draw_gradient(), qt_cleanlooks_draw_mdibutton(), qt_cleanup(), qt_mac_get_widget_rgn(), qt_mac_nativeMapFromParent(), qt_mac_unregister_widget(), qt_mac_update_widget_position(), qt_plastique_draw_gradient(), qt_scrollRectInImage(), qt_win_getKeyboardModifiers(), qt_x11_drawImage(), QtWndProc(), QGLMaskTextureCache::quadtreeClear(), QGLMaskTextureCache::quadtreeLocation(), QVNCClientCursor::QVNCClientCursor(), QSvgIOHandler::read(), QDirectFBMouseHandlerPrivate::readMouseData(), QWSLinuxTPMouseHandlerPrivate::readMouseData(), QMdi::IconTiler::rearrange(), QWinNativePanGestureRecognizer::recognize(), QSwipeGestureRecognizer::recognize(), QAccessibleMenu::rect(), QAccessibleWidget::rect(), QAccessibleTable2::rect(), QAccessibleAbstractSpinBox::rect(), QAccessibleMenuBar::rect(), QAccessibleHeader::rect(), QAccessibleDoubleSpinBox::rect(), QAccessibleScrollBar::rect(), QAccessibleSlider::rect(), QAccessibleDial::rect(), QAccessibleTabBar::rect(), QAccessibleTable2HeaderCell::rect(), QAccessibleMdiSubWindow::rect(), QAccessibleComboBox::rect(), QAccessibleWidget::relationTo(), QWidgetPrivate::render_helper(), QBBScreen::resizeNativeWidgetWindow(), QExpandingLineEdit::resizeToContents(), QBBScreen::resizeTopLevelWindow(), QIntMouseListenThread::run(), QWhatsThisPrivate::say(), QVNCCursor::sendClientCursor(), QWSPcMouseHandlerPrivate::sendEvent(), QWSServer::sendMouseEvent(), QWSInputMethod::sendMouseEvent(), QLineEditPrivate::sendMouseEventToInputContext(), QWSServerPrivate::sendMouseEventUnfiltered(), QRect::setBottomLeft(), QRect::setBottomRight(), QWSServerPrivate::setCursor(), QWidgetPrivate::setGeometry_sys(), QMdiSubWindowPrivate::setNewGeometry(), QHeaderView::setOffset(), QXcbWindow::setParent(), QXlibWindow::setParent(), QImage::setPixel(), QCursor::setPos(), QListView::setSelection(), QRect::setTopLeft(), QRect::setTopRight(), QGLShaderProgram::setUniformValue(), QX11PaintEnginePrivate::setupAdaptedOrigin(), QDeclarativePointValueType::setValue(), QPainter::setViewTransformEnabled(), QAbstractItemViewPrivate::shouldAutoScroll(), QCompleterPrivate::showPopup(), QComboBox::showPopup(), QWhatsThis::showText(), QIconModeViewBase::snapToGrid(), QWorkspace::tile(), QPlainTextEdit::timerEvent(), QTextEdit::timerEvent(), QApplication::topLevelAt(), QTest::toString(), QSplitterPrivate::trans(), QWSCalibratedMouseHandler::transform(), QPolygon::translate(), QRegion::translate(), QRect::translate(), QPainter::translate(), QPolygon::translated(), QRegion::translated(), QRect::translated(), QETWidget::translateMouseEvent(), QImage::trueMatrix(), QWSPcMouseSubHandler_intellimouse::tryData(), QWSPcMouseSubHandler_mouseman::tryData(), QWSPcMouseSubHandler_mousesystems::tryData(), QWSPcMouseSubHandler_ms::tryData(), QXIMInputContext::update(), updateRedirectedToGraphicsProxyWidget(), QImage::valid(), QDialPrivate::valueFromPoint(), QSettingsPrivate::variantToString(), QStyle::visualPos(), QApplication::widgetAt(), QVNCClientCursor::write(), QPNGImageWriter::writeImage(), QLine::x1(), QSystemTrayIconSys::x11Event(), QApplication::x11EventFilter(), QApplication::x11ProcessEvent(), and QLine::x2().

129 { return xp; }
int xp
Definition: qpoint.h:98

◆ y()

int QPoint::y ( ) const
inline

Returns the y coordinate of this point.

See also
setY(), ry()

Definition at line 131 of file qpoint.h.

Referenced by QPushButtonPrivate::adjustedMenuPosition(), QDialog::adjustPosition(), QPainterPrivate::attachPainterPrivate(), QBalloonTip::balloon(), QPainter::begin(), blendCursor(), QAhiScreen::blit(), blit180(), blit270(), blit90(), blit_template(), QPolygon::boundingRect(), QWSCalibratedMouseHandler::calibrate(), QDirectFBCursor::changeCursor(), QPlatformSoftwareCursor::changeCursor(), QAccessibleWidget::childAt(), QAccessibleComboBox::childAt(), QAccessibleMainWindow::childAt(), clipStraightLine(), QListViewPrivate::closestIndex(), QScreen::compose(), QOpenGLPaintEnginePrivate::composite(), QRegion::contains(), QRect::contains(), convolute(), QSizeGripPrivate::corner(), QXlibCursor::createCursorBitmap(), QOleDropSource::createCursors(), CreateETandAET(), QDirectFBScreen::createSurface(), QToolBarAreaLayoutInfo::distance(), QAbstractItemView::doAutoScroll(), dockPosHelper(), QIconModeViewBase::doDynamicLayout(), QWidgetResizeHandler::doResize(), QListModeViewBase::doStaticLayout(), QDragManager::drag(), QListModeViewBase::dragMoveEvent(), QColorWell::dragMoveEvent(), QGraphicsOpacityEffect::draw(), QRenderRule::drawBackgroundImage(), QWindowsVistaStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QCommonStyle::drawControl(), QWindowsCEStyle::drawControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsStyle::drawControl(), QGtkStyle::drawControl(), QVGCompositionHelper::drawCursorPixmap(), QPainter::drawEllipse(), QX11PaintEngine::drawFreetype(), QPainter::drawImage(), QPainter::drawPixmap(), QX11PaintEngine::drawPoints(), QOpenGLPaintEngine::drawPoints(), QVGPaintEngine::drawPoints(), QPaintEngine::drawPoints(), QPaintEngineEx::drawPoints(), QPainter::drawPoints(), drawPoints(), QVGPaintEngine::drawPolygon(), QOpenGLPaintEngine::drawPolygon(), QPaintEngine::drawPolygon(), QPaintBufferEngine::drawPolygon(), QCommonStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QMacStyle::drawPrimitive(), QX11PaintEngine::drawRects(), QTreeView::drawRow(), QWindowsMobileStylePrivate::drawScrollbarGrip(), QVistaHelper::drawTitleBar(), QColorWell::dropEvent(), QListModeViewBase::dropOn(), QLine::dy(), effectiveState(), QScrollArea::ensureWidgetVisible(), QMdiSubWindowPrivate::enterRubberBandMode(), QDockWidget::event(), QScriptEdit::extraAreaMouseEvent(), QX11Data::findClientWindow(), findRealWindow(), QSystemTrayIconSys::findTrayGeometry(), flipPoint(), QDirectFBScreen::flipSurface(), QListViewPrivate::flipX(), QDirectFbWindowSurface::flush(), QX11WindowSurface::flush(), QRasterWindowSurface::flush(), QGraphicsScenePrivate::gestureEventHandler(), QWSCalibratedMouseHandler::getCalibration(), QPlatformSoftwareCursor::getCurrentRect(), QApplicationPrivate::globalEventProcessor(), QPixmap::grabWindow(), QBBScreenEventHandler::handlePointerEvent(), QBBScreenEventHandler::handleTouchEvent(), QMacStyle::hitTestComplexControl(), QColumnView::indexAt(), QTableView::indexAt(), QListView::indexAt(), QTreeView::indexAt(), QBspTree::init(), QToolBarPrivate::initDrag(), QBBScreenEventHandler::injectPointerMoveEvent(), QMenu::internalDelayedPopup(), QWidgetPrivate::invalidateBuffer_resizeHelper(), QWidgetPrivate::isBackgroundInherited(), isServerProcess(), QTreeViewPrivate::itemDecorationAt(), Q3AccessibleTextEdit::itemRect(), QGraphicsView::items(), QWidgetResizeHandler::keyPressEvent(), QMenu::keyPressEvent(), QAbstractScrollAreaPrivate::layoutChildren(), QTabBarPrivate::layoutTab(), QApplicationPrivate::leaveModal_sys(), QWSMouseHandler::limitToScreen(), QHeaderView::logicalIndexAt(), make_widget_eventUPP(), manhattanLength(), QPointF::manhattanLength(), QMatrix::map(), QTransform::map(), QTransformedScreen::mapFromDevice(), QWidget::mapFromGlobal(), QWidgetPrivate::mapFromGlobal(), QMatrix4x4::mapRect(), QTextEditPrivate::mapToContents(), QPlainTextEditPrivate::mapToContents(), QTransformedScreen::mapToDevice(), QWidget::mapToGlobal(), QWidgetPrivate::mapToGlobal(), QMenuPrivate::mouseEventTaken(), QScrollBar::mouseMoveEvent(), QWidgetResizeHandler::mouseMoveEvent(), QToolBarPrivate::mouseMoveEvent(), QVistaHelper::mouseMoveEvent(), QComboBoxPrivateScroller::mouseMoveEvent(), QGraphicsView::mouseMoveEvent(), QWorkspaceTitleBar::mouseMoveEvent(), QSizeGrip::mousePressEvent(), QScrollBar::mousePressEvent(), QWellArray::mousePressEvent(), QMultiScreenCursor::move(), QRubberBand::move(), QListViewItem::move(), QWidget::move(), QDirectFBScreenCursor::move(), QRect::moveBottomLeft(), QRect::moveBottomRight(), QRect::moveCenter(), QAbstractButtonPrivate::moveFocus(), QRect::moveTo(), QRect::moveTopLeft(), QRect::moveTopRight(), QAccessibleWidget::navigate(), operator*(), operator<<(), operator>>(), QTableView::paintEvent(), QColorPicker::paintEvent(), perp(), pick(), QSliderPrivate::pick(), QSplitterPrivate::pick(), QSplitterHandlePrivate::pick(), QmlJSDebugger::ColorPickerTool::pickColor(), QImage::pixel(), QImage::pixelIndex(), QMdiAreaPrivate::place(), QTipLabel::placeTip(), QPolygon::point(), QWidgetPrivate::pointToRect(), PolygonRegion(), QMenu::popup(), QMenuBarPrivate::popupAction(), QAbstractItemViewPrivate::position(), QDateTimeEditPrivate::positionCalendarPopup(), PtsToRegion(), QXcbShmImage::put(), PvrEglWindowSurface::PvrEglWindowSurface(), q_createNativeChildrenAndSetParent(), qDrawShadeLine(), QRect::QRect(), qstring_to_xtp(), qt_bitmapToRegion(), qt_cleanlooks_draw_buttongradient(), qt_cleanlooks_draw_gradient(), qt_cleanup(), qt_mac_get_widget_rgn(), qt_mac_nativeMapFromParent(), qt_mac_unregister_widget(), qt_mac_update_widget_position(), qt_scrollRectInImage(), qt_win_getKeyboardModifiers(), qt_x11_drawImage(), QtWndProc(), QGLMaskTextureCache::quadtreeClear(), QGLMaskTextureCache::quadtreeLocation(), QVNCClientCursor::QVNCClientCursor(), QSvgIOHandler::read(), QDirectFBMouseHandlerPrivate::readMouseData(), QWSLinuxTPMouseHandlerPrivate::readMouseData(), QMdi::IconTiler::rearrange(), QWinNativePanGestureRecognizer::recognize(), QSwipeGestureRecognizer::recognize(), QAccessibleMenu::rect(), QAccessibleWidget::rect(), QAccessibleTable2::rect(), QAccessibleAbstractSpinBox::rect(), QAccessibleMenuBar::rect(), QAccessibleHeader::rect(), QAccessibleDoubleSpinBox::rect(), QAccessibleScrollBar::rect(), QAccessibleSlider::rect(), QAccessibleDial::rect(), QAccessibleTabBar::rect(), QAccessibleTable2HeaderCell::rect(), QAccessibleMdiSubWindow::rect(), QAccessibleComboBox::rect(), QAccessibleTitleBar::rect(), QAccessibleWidget::relationTo(), QWidgetPrivate::render_helper(), QBBScreen::resizeNativeWidgetWindow(), QExpandingLineEdit::resizeToContents(), QBBScreen::resizeTopLevelWindow(), QIntMouseListenThread::run(), QColorPicker::satPt(), QWhatsThisPrivate::say(), QVNCCursor::sendClientCursor(), QWSPcMouseHandlerPrivate::sendEvent(), QWSServer::sendMouseEvent(), QWSInputMethod::sendMouseEvent(), QWSServerPrivate::sendMouseEventUnfiltered(), QRect::setBottomLeft(), QRect::setBottomRight(), QWSServerPrivate::setCursor(), QWidgetPrivate::setGeometry_sys(), QMdiSubWindowPrivate::setNewGeometry(), QHeaderView::setOffset(), QXcbWindow::setParent(), QXlibWindow::setParent(), QImage::setPixel(), QCursor::setPos(), QListView::setSelection(), QRect::setTopLeft(), QRect::setTopRight(), QGLShaderProgram::setUniformValue(), QX11PaintEnginePrivate::setupAdaptedOrigin(), QDeclarativePointValueType::setValue(), QPainter::setViewTransformEnabled(), QAbstractItemViewPrivate::shouldAutoScroll(), QCompleterPrivate::showPopup(), QComboBox::showPopup(), QWhatsThis::showText(), QIconModeViewBase::snapToGrid(), QStyleSheetStyle::subControlRect(), QCommonStyle::subElementRect(), QMacStyle::subElementRect(), QCommonStylePrivate::tabLayout(), QWorkspace::tile(), QPlainTextEdit::timerEvent(), QTextEdit::timerEvent(), QApplication::topLevelAt(), QTest::toString(), QSplitterPrivate::trans(), QWSCalibratedMouseHandler::transform(), QPolygon::translate(), QRegion::translate(), QRect::translate(), QPainter::translate(), QPolygon::translated(), QRegion::translated(), QRect::translated(), QETWidget::translateMouseEvent(), QImage::trueMatrix(), QWSPcMouseSubHandler_intellimouse::tryData(), QWSPcMouseSubHandler_mouseman::tryData(), QWSPcMouseSubHandler_mousesystems::tryData(), QWSPcMouseSubHandler_ms::tryData(), QXIMInputContext::update(), updateRedirectedToGraphicsProxyWidget(), QImage::valid(), QDialPrivate::valueFromPoint(), QSettingsPrivate::variantToString(), QStyle::visualPos(), QApplication::widgetAt(), QVNCClientCursor::write(), QPNGImageWriter::writeImage(), QSystemTrayIconSys::x11Event(), QApplication::x11EventFilter(), QApplication::x11ProcessEvent(), QLine::y1(), and QLine::y2().

132 { return yp; }
int yp
Definition: qpoint.h:97

Friends and Related Functions

◆ operator!=

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

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

Definition at line 164 of file qpoint.h.

165 { return p1.xp != p2.xp || p1.yp != p2.yp; }
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

◆ operator* [1/6]

const QPoint operator* ( const QPoint point,
float  factor 
)
friend
Since
4.8

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 173 of file qpoint.h.

174 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
QPoint()
Constructs a null point, i.
Definition: qpoint.h:119
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator* [2/6]

const 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.

Since
4.8

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

Definition at line 182 of file qpoint.h.

183 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
QPoint()
Constructs a null point, i.
Definition: qpoint.h:119
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator* [3/6]

const QPoint operator* ( const QPoint point,
double  factor 
)
friend
Since
4.8

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 176 of file qpoint.h.

177 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
QPoint()
Constructs a null point, i.
Definition: qpoint.h:119
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator* [4/6]

const 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.

Since
4.8

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

Definition at line 185 of file qpoint.h.

186 { return QPoint(qRound(p.xp*c), qRound(p.yp*c)); }
unsigned char c[8]
Definition: qnumeric_p.h:62
QPoint()
Constructs a null point, i.
Definition: qpoint.h:119
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ operator* [5/6]

const QPoint operator* ( const QPoint point,
int  factor 
)
friend
Since
4.8

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

See also
QPoint::operator*=()

Definition at line 179 of file qpoint.h.

180 { return QPoint(p.xp*c, p.yp*c); }
unsigned char c[8]
Definition: qnumeric_p.h:62
QPoint()
Constructs a null point, i.
Definition: qpoint.h:119

◆ operator* [6/6]

const 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.

Since
4.8

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

Definition at line 188 of file qpoint.h.

189 { return QPoint(p.xp*c, p.yp*c); }
unsigned char c[8]
Definition: qnumeric_p.h:62
QPoint()
Constructs a null point, i.
Definition: qpoint.h:119

◆ operator+

const 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 167 of file qpoint.h.

168 { return QPoint(p1.xp+p2.xp, p1.yp+p2.yp); }
QPoint()
Constructs a null point, i.
Definition: qpoint.h:119
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

◆ operator- [1/2]

const 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 170 of file qpoint.h.

171 { return QPoint(p1.xp-p2.xp, p1.yp-p2.yp); }
QPoint()
Constructs a null point, i.
Definition: qpoint.h:119
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

◆ operator- [2/2]

const QPoint operator- ( const QPoint point)
friend

Returns a QPoint object that is formed by changing the sign of both components of the given point.

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

Equivalent to QPoint(0,0) - point.

Definition at line 191 of file qpoint.h.

192 { return QPoint(-p.xp, -p.yp); }
QPoint()
Constructs a null point, i.
Definition: qpoint.h:119

◆ operator/

const 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 201 of file qpoint.h.

202 {
203  return QPoint(qRound(p.xp/c), qRound(p.yp/c));
204 }
unsigned char c[8]
Definition: qnumeric_p.h:62
QPoint()
Constructs a null point, i.
Definition: qpoint.h:119
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ 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 435 of file qpoint.cpp.

Referenced by operator/().

436 {
437  if (s.version() == 1)
438  s << (qint16)p.x() << (qint16)p.y();
439  else
440  s << (qint32)p.x() << (qint32)p.y();
441  return s;
442 }
int qint32
Definition: qglobal.h:937
short qint16
Definition: qglobal.h:935

◆ operator==

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

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

Definition at line 161 of file qpoint.h.

162 { return p1.xp == p2.xp && p1.yp == p2.yp; }
int xp
Definition: qpoint.h:98
int yp
Definition: qpoint.h:97

◆ 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 457 of file qpoint.cpp.

458 {
459  if (s.version() == 1) {
460  qint16 x, y;
461  s >> x; p.rx() = x;
462  s >> y; p.ry() = y;
463  }
464  else {
465  qint32 x, y;
466  s >> x; p.rx() = x;
467  s >> y; p.ry() = y;
468  }
469  return s;
470 }
int qint32
Definition: qglobal.h:937
short qint16
Definition: qglobal.h:935
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128

◆ QTransform

friend class QTransform
friend

Definition at line 94 of file qpoint.h.

Properties

◆ xp

int QPoint::xp
private

◆ yp

int QPoint::yp
private

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