Qt:Документация 4.3.2/qgraphicslineitem

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

[править] QGraphicsLineItem Class Reference
[модуль QtGui ]

The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene. Далее...

 #include <QGraphicsLineItem>

Inherits QGraphicsItem.

Класс был добавлен в Qt 4.2.

[править] Открытые функции

[править] Дополнительные унаследованные члены


[править] Подробное описание

The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene.

To set the item's line, pass a QLineF to QGraphicsLineItem's constructor, or call the setLine() function. The line() function returns the current line. By default the line is black with a width of 0, but you can change this by calling setPen().

center

QGraphicsLineItem uses the line and the pen width to provide a reasonable implementation of boundingRect(), shape(), and contains(). The paint() function draws the line using the item's associated pen.

See also QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsTextItem, QGraphicsPolygonItem, QGraphicsPixmapItem, and The Graphics View Framework.


[править] Описание функций-членов

[править]
QGraphicsLineItem::QGraphicsLineItem ( QGraphicsItem * parent = 0 )

Constructs a QGraphicsLineItem. parent is passed to QGraphicsItem's constructor.

See also QGraphicsScene::addItem().

[править]
QGraphicsLineItem::QGraphicsLineItem ( const QLineF & line, QGraphicsItem * parent = 0 )

Constructs a QGraphicsLineItem, using line as the default line. parent is passed to QGraphicsItem's constructor.

See also QGraphicsScene::addItem().

[править]
QGraphicsLineItem::QGraphicsLineItem ( qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem * parent = 0 )

Constructs a QGraphicsLineItem, using the line between (x1, y1) and (x2, y2) as the default line. parent is passed to QGraphicsItem's constructor.

See also QGraphicsScene::addItem().

[править]
QGraphicsLineItem::~QGraphicsLineItem ()

Destroys the QGraphicsLineItem.

[править]
QLineF QGraphicsLineItem::line () const

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

See also setLine().

[править]
QPen QGraphicsLineItem::pen () const

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

See also setPen().

[править]
void QGraphicsLineItem::setLine ( const QLineF & line )

Sets the item's line to be the given line.

See also line().

[править]
void QGraphicsLineItem::setLine ( qreal x1, qreal y1, qreal x2, qreal y2 )

Эта перегруженная функция предоставлена для удобства.

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

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

[править]
void QGraphicsLineItem::setPen ( const QPen & pen )

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

See also pen().



Copyright © 2007 Trolltech Trademarks
Qt 4.3.2