Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QLine Class

TheQLine class provides a two-dimensional vector using integer precision.More...

Header:#include <QLine>

Public Functions

QLine()
QLine(const QPoint & p1, const QPoint & p2)
QLine(int x1, int y1, int x2, int y2)
QPointp1() const
QPointp2() const
intx1() const
intx2() const
inty1() const
inty2() const
intdx() const
intdy() const
boolisNull() const
voidsetP1(const QPoint & p1)
voidsetP2(const QPoint & p2)
voidsetLine(int x1, int y1, int x2, int y2)
voidsetPoints(const QPoint & p1, const QPoint & p2)
voidtranslate(const QPoint & offset)
voidtranslate(int dx, int dy)
QLinetranslated(const QPoint & offset) const
QLinetranslated(int dx, int dy) const
booloperator!=(const QLine & line) const
booloperator==(const QLine & line) const

Related Non-Members

QDataStream &operator<<(QDataStream & stream, const QLine & line)
QDataStream &operator>>(QDataStream & stream, QLine & line)

Detailed Description

TheQLine class provides a two-dimensional vector using integer precision.

AQLine describes a finite length line (or a line segment) on a two-dimensional surface. The start and end points of the line are specified using integer point accuracy for coordinates. Use theQLineF constructor to retrieve a floating point copy.

The positions of the line's start and end points can be retrieved using thep1(),x1(),y1(),p2(),x2(), andy2() functions. Thedx() anddy() functions return the horizontal and vertical components of the line. UseisNull() to determine whether theQLine represents a valid line or a null line.

Finally, the line can be translated a given offset using thetranslate() function.

See alsoQLineF,QPolygon, andQRect.

Member Function Documentation

QLine::QLine()

Constructs a null line.

QLine::QLine(constQPoint & p1, constQPoint & p2)

Constructs a line object that represents the line betweenp1 andp2.

QLine::QLine(int x1,int y1,int x2,int y2)

Constructs a line object that represents the line between (x1,y1) and (x2,y2).

QPoint QLine::p1() const

Returns the line's start point.

See alsosetP1(),x1(),y1(), andp2().

QPoint QLine::p2() const

Returns the line's end point.

See alsosetP2(),x2(),y2(), andp1().

int QLine::x1() const

Returns the x-coordinate of the line's start point.

See alsop1().

int QLine::x2() const

Returns the x-coordinate of the line's end point.

See alsop2().

int QLine::y1() const

Returns the y-coordinate of the line's start point.

See alsop1().

int QLine::y2() const

Returns the y-coordinate of the line's end point.

See alsop2().

int QLine::dx() const

Returns the horizontal component of the line's vector.

See alsody().

int QLine::dy() const

Returns the vertical component of the line's vector.

See alsodx().

bool QLine::isNull() const

Returns true if the line is not set up with valid start and end point; otherwise returns false.

void QLine::setP1(constQPoint & p1)

Sets the starting point of this line top1.

This function was introduced in Qt 4.4.

See alsosetP2() andp1().

void QLine::setP2(constQPoint & p2)

Sets the end point of this line top2.

This function was introduced in Qt 4.4.

See alsosetP1() andp2().

void QLine::setLine(int x1,int y1,int x2,int y2)

Sets this line to the start inx1,y1 and end inx2,y2.

This function was introduced in Qt 4.4.

See alsosetP1(),setP2(),p1(), andp2().

void QLine::setPoints(constQPoint & p1, constQPoint & p2)

Sets the start point of this line top1 and the end point of this line top2.

This function was introduced in Qt 4.4.

See alsosetP1(),setP2(),p1(), andp2().

void QLine::translate(constQPoint & offset)

Translates this line by the givenoffset.

void QLine::translate(int dx,int dy)

This is an overloaded function.

Translates this line the distance specified bydx anddy.

QLine QLine::translated(constQPoint & offset) const

Returns this line translated by the givenoffset.

This function was introduced in Qt 4.4.

QLine QLine::translated(int dx,int dy) const

This is an overloaded function.

Returns this line translated the distance specified bydx anddy.

This function was introduced in Qt 4.4.

bool QLine::operator!=(constQLine & line) const

Returns true if the givenline is not the same asthis line.

A line is different from another line if any of their start or end points differ, or the internal order of the points is different.

bool QLine::operator==(constQLine & line) const

Returns true if the givenline is the same asthis line.

A line is identical to another line if the start and end points are identical, and the internal order of the points is the same.

Related Non-Members

QDataStream &operator<<(QDataStream & stream, constQLine & line)

Writes the givenline to the givenstream and returns a reference to the stream.

See alsoSerializing Qt Data Types.

QDataStream &operator>>(QDataStream & stream,QLine & line)

Reads a line from the givenstream into the givenline and returns a reference to the stream.

See alsoSerializing Qt Data Types.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp