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

QGraphicsLineItem Class

TheQGraphicsLineItem class provides a line item that you can add to aQGraphicsScene.More...

Header:#include <QGraphicsLineItem>
Since: Qt 4.2
Inherits:QGraphicsItem

Public Functions

QGraphicsLineItem(QGraphicsItem * parent = 0)
QGraphicsLineItem(const QLineF & line, QGraphicsItem * parent = 0)
QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem * parent = 0)
~QGraphicsLineItem()
QLineFline() const
QPenpen() const
voidsetLine(const QLineF & line)
voidsetLine(qreal x1, qreal y1, qreal x2, qreal y2)
voidsetPen(const QPen & pen)

Reimplemented Public Functions

virtual QRectFboundingRect() const
virtual boolcontains(const QPointF & point) const
virtual boolisObscuredBy(const QGraphicsItem * item) const
virtual QPainterPathopaqueArea() const
virtual voidpaint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0)
virtual QPainterPathshape() const
virtual inttype() const

Additional Inherited Members

Detailed Description

TheQGraphicsLineItem class provides a line item that you can add to aQGraphicsScene.

To set the item's line, pass aQLineF toQGraphicsLineItem's constructor, or call thesetLine() function. Theline() function returns the current line. By default the line is black with a width of 0, but you can change this by callingsetPen().

QGraphicsLineItem uses the line and the pen width to provide a reasonable implementation ofboundingRect(),shape(), andcontains(). Thepaint() function draws the line using the item's associated pen.

See alsoQGraphicsPathItem,QGraphicsRectItem,QGraphicsEllipseItem,QGraphicsTextItem,QGraphicsPolygonItem,QGraphicsPixmapItem, andGraphics View Framework.

Member Function Documentation

QGraphicsLineItem::QGraphicsLineItem(QGraphicsItem * parent = 0)

Constructs aQGraphicsLineItem.parent is passed toQGraphicsItem's constructor.

See alsoQGraphicsScene::addItem().

QGraphicsLineItem::QGraphicsLineItem(constQLineF & line,QGraphicsItem * parent = 0)

Constructs aQGraphicsLineItem, usingline as the default line.parent is passed toQGraphicsItem's constructor.

See alsoQGraphicsScene::addItem().

QGraphicsLineItem::QGraphicsLineItem(qreal x1,qreal y1,qreal x2,qreal y2,QGraphicsItem * parent = 0)

Constructs aQGraphicsLineItem, using the line between (x1,y1) and (x2,y2) as the default line.parent is passed toQGraphicsItem's constructor.

See alsoQGraphicsScene::addItem().

QGraphicsLineItem::~QGraphicsLineItem()

Destroys theQGraphicsLineItem.

[virtual]QRectF QGraphicsLineItem::boundingRect() const

Reimplemented fromQGraphicsItem::boundingRect().

[virtual]bool QGraphicsLineItem::contains(constQPointF & point) const

Reimplemented fromQGraphicsItem::contains().

[virtual]bool QGraphicsLineItem::isObscuredBy(constQGraphicsItem * item) const

Reimplemented fromQGraphicsItem::isObscuredBy().

QLineF QGraphicsLineItem::line() const

Returns the item's line, or a null line if no line has been set.

See alsosetLine().

[virtual]QPainterPath QGraphicsLineItem::opaqueArea() const

Reimplemented fromQGraphicsItem::opaqueArea().

[virtual]void QGraphicsLineItem::paint(QPainter * painter, constQStyleOptionGraphicsItem * option,QWidget * widget = 0)

Reimplemented fromQGraphicsItem::paint().

QPen QGraphicsLineItem::pen() const

Returns the item's pen, or a black solid 0-width pen if no pen has been set.

See alsosetPen().

void QGraphicsLineItem::setLine(constQLineF & line)

Sets the item's line to be the givenline.

See alsoline().

void QGraphicsLineItem::setLine(qreal x1,qreal y1,qreal x2,qreal y2)

This is an overloaded function.

Sets the item's line to be the line between (x1,y1) and (x2,y2).

This is the same as callingsetLine(QLineF(x1, y1, x2, y2)).

void QGraphicsLineItem::setPen(constQPen & pen)

Sets the item's pen topen. If no pen is set, the line will be painted using a black solid 0-width pen.

See alsopen().

[virtual]QPainterPath QGraphicsLineItem::shape() const

Reimplemented fromQGraphicsItem::shape().

[virtual]int QGraphicsLineItem::type() const

Reimplemented fromQGraphicsItem::type().

© 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