Logo    
KDWinUtils
Helper library for MFC to Qt migration
Loading...
Searching...
No Matches
KPoint Class Reference

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

#include <kpoint.h>

Public Member Functions

 KPoint ()
 
 KPoint (const CPoint &cp)
 
 KPoint (const KSize &cs)
 
 KPoint (const QPoint &qp)
 
 KPoint (int x, int y)
 
void Offset (const KPoint &other)
 Adds values to the x and y members of the KPoint.
 
void Offset (int xOffset, int yOffset)
 Adds values to the x and y members of the KPoint.
 
 operator CPoint () const
 
 operator QPoint () const
 
void operator+= (const KPoint &cp)
 Offsets KPoint by adding a KPoint.
 
void operator+= (const KSize &cs)
 Offsets KPoint by adding a KSize.
 
void operator-= (const KPoint &cp)
 Offsets KPoint by subtracting a KPoint.
 
void operator-= (const KSize &cs)
 Offsets KPoint by subtracting a KSize.
 
KPointoperator= (const CPoint &cp)
 
KPointoperator= (const QPoint &point)
 
CPoint toCPoint () const
 
QPoint toQPoint () const
 

Public Attributes

int x = 0
 
int y = 0
 

Related Symbols

(Note that these are not member symbols.)

bool operator!= (const KPoint &lhs, const KPoint &rhs) noexcept
 Checks for inequality between two KPoints.
 
KPoint operator+ (const KPoint &lhs, const KPoint &rhs)
 Returns the sum of 2 KPoints.
 
KRect operator+ (const KPoint &lhs, const KRect &rhs)
 Returns a KRect that is offset by a KPoint.
 
KPoint operator+ (const KPoint &lhs, const KSize &rhs)
 Returns the sum of a KPoint and a KSize.
 
KSize operator- (const KPoint &lhs, const KPoint &rhs)
 Subtracts two points and returns a size.
 
KRect operator- (const KPoint &lhs, const KRect &rhs)
 Returns a KRect that is offset by the negation of a KPoint.
 
KPoint operator- (const KPoint &lhs, const KSize &rhs)
 Returns the difference of a KPoint and a KSize.
 
KPoint operator- (const KPoint &point)
 Returns the negation of a KPoint.
 
bool operator== (const KPoint &lhs, const KPoint &rhs) noexcept
 Checks for equality between two KPoints.
 

Detailed Description

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

This class can replace CPoint with the same API, and is compatible with both CPoint and QPoint.

See also
https://learn.microsoft.com/en-us/cpp/atl-mfc-shared/reference/cpoint-class

Constructor & Destructor Documentation

◆ KPoint() [1/5]

KPoint::KPoint ( )

◆ KPoint() [2/5]

KPoint::KPoint ( const KSize & cs)

◆ KPoint() [3/5]

KPoint::KPoint ( int x,
int y )
explicit

◆ KPoint() [4/5]

KPoint::KPoint ( const QPoint & qp)

◆ KPoint() [5/5]

KPoint::KPoint ( const CPoint & cp)
explicit

Member Function Documentation

◆ Offset() [1/2]

void KPoint::Offset ( const KPoint & other)

Adds values to the x and y members of the KPoint.

◆ Offset() [2/2]

void KPoint::Offset ( int xOffset,
int yOffset )

Adds values to the x and y members of the KPoint.

◆ operator CPoint()

KPoint::operator CPoint ( ) const

◆ operator QPoint()

KPoint::operator QPoint ( ) const

◆ operator+=() [1/2]

void KPoint::operator+= ( const KPoint & cp)

Offsets KPoint by adding a KPoint.

◆ operator+=() [2/2]

void KPoint::operator+= ( const KSize & cs)

Offsets KPoint by adding a KSize.

◆ operator-=() [1/2]

void KPoint::operator-= ( const KPoint & cp)

Offsets KPoint by subtracting a KPoint.

◆ operator-=() [2/2]

void KPoint::operator-= ( const KSize & cs)

Offsets KPoint by subtracting a KSize.

◆ operator=() [1/2]

KPoint & KPoint::operator= ( const CPoint & cp)

◆ operator=() [2/2]

KPoint & KPoint::operator= ( const QPoint & point)

◆ toCPoint()

CPoint KPoint::toCPoint ( ) const

◆ toQPoint()

QPoint KPoint::toQPoint ( ) const

Friends And Related Symbol Documentation

◆ operator!=()

bool operator!= ( const KPoint & lhs,
const KPoint & rhs )
related

Checks for inequality between two KPoints.

◆ operator+() [1/3]

KPoint operator+ ( const KPoint & lhs,
const KPoint & rhs )
related

Returns the sum of 2 KPoints.

◆ operator+() [2/3]

KRect operator+ ( const KPoint & lhs,
const KRect & rhs )
related

Returns a KRect that is offset by a KPoint.

◆ operator+() [3/3]

KPoint operator+ ( const KPoint & lhs,
const KSize & rhs )
related

Returns the sum of a KPoint and a KSize.

◆ operator-() [1/4]

KSize operator- ( const KPoint & lhs,
const KPoint & rhs )
related

Subtracts two points and returns a size.

◆ operator-() [2/4]

KRect operator- ( const KPoint & lhs,
const KRect & rhs )
related

Returns a KRect that is offset by the negation of a KPoint.

◆ operator-() [3/4]

KPoint operator- ( const KPoint & lhs,
const KSize & rhs )
related

Returns the difference of a KPoint and a KSize.

◆ operator-() [4/4]

KPoint operator- ( const KPoint & point)
related

Returns the negation of a KPoint.

◆ operator==()

bool operator== ( const KPoint & lhs,
const KPoint & rhs )
related

Checks for equality between two KPoints.

Member Data Documentation

◆ x

int KPoint::x = 0

◆ y

int KPoint::y = 0

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