The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene . 更多...
| 頭: | #include <QGraphicsLineItem> |
| qmake: | QT += widgets |
| Since: | Qt 4.2 |
| 繼承: | QGraphicsItem |
| QGraphicsLineItem (QGraphicsItem * parent = Q_NULLPTR) | |
| QGraphicsLineItem (const QLineF & line , QGraphicsItem * parent = Q_NULLPTR) | |
| QGraphicsLineItem (qreal x1 , qreal y1 , qreal x2 , qreal y2 , QGraphicsItem * parent = Q_NULLPTR) | |
| ~QGraphicsLineItem () | |
| QLineF | line () const |
| QPen | pen () const |
| void | setLine (const QLineF & line ) |
| void | setLine (qreal x1 , qreal y1 , qreal x2 , qreal y2 ) |
| void | setPen (const QPen & pen ) |
| virtual QRectF | boundingRect () const |
| virtual bool | contains (const QPointF & point ) const |
| virtual bool | isObscuredBy (const QGraphicsItem * item ) const |
| virtual QPainterPath | opaqueArea () const |
| virtual void | paint (QPainter * painter , const QStyleOptionGraphicsItem * option , QWidget * widget = Q_NULLPTR) |
| virtual QPainterPath | shape () const |
| virtual int | type () const |
The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene .
要設置項的綫條,傳遞 QLineF to QGraphicsLineItem 's constructor, or call the setLine () 函數。 line () 函數返迴當前綫條。默認情況下,綫條為黑色具有 0 寬度,但可以改變這通過調用 setPen ().
QGraphicsLineItem uses the line and the pen width to provide a reasonable implementation of boundingRect (), shape (),和 contains ()。 paint () 函數使用項關聯的鋼筆繪製綫條。
另請參閱 QGraphicsPathItem , QGraphicsRectItem , QGraphicsEllipseItem , QGraphicsTextItem , QGraphicsPolygonItem , QGraphicsPixmapItem ,和 圖形視圖框架 .
構造 QGraphicsLineItem . parent 被傳遞給 QGraphicsItem 的構造函數。
另請參閱 QGraphicsScene::addItem ().
構造 QGraphicsLineItem ,使用 line 作為默認綫條。 parent 被傳遞給 QGraphicsItem 的構造函數。
另請參閱 QGraphicsScene::addItem ().
構造 QGraphicsLineItem , using the line between ( x1 , y1 ) 和 ( x2 , y2 ) 作為默認綫條。 parent 被傳遞給 QGraphicsItem 的構造函數。
另請參閱 QGraphicsScene::addItem ().
銷毀 QGraphicsLineItem .
[虛擬]
QRectF
QGraphicsLineItem::
boundingRect
() const
重實現自 QGraphicsItem::boundingRect ().
[虛擬]
bool
QGraphicsLineItem::
contains
(const
QPointF
&
point
) const
重實現自 QGraphicsItem::contains ().
[虛擬]
bool
QGraphicsLineItem::
isObscuredBy
(const
QGraphicsItem
*
item
) const
重實現自 QGraphicsItem::isObscuredBy ().
返迴項的綫條,或 null 綫條若未設置綫條。
另請參閱 setLine ().
[虛擬]
QPainterPath
QGraphicsLineItem::
opaqueArea
() const
重實現自 QGraphicsItem::opaqueArea ().
[虛擬]
void
QGraphicsLineItem::
paint
(
QPainter
*
painter
, const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
= Q_NULLPTR)
重實現自 QGraphicsItem::paint ().
返迴項的鋼筆,或黑色 0 寬度實綫鋼筆若未設置鋼筆。
另請參閱 setPen ().
將項的綫條設為給定 line .
另請參閱 line ().
這是重載函數。
Sets the item's line to be the line between ( x1 , y1 ) 和 ( x2 , y2 ).
這如同調用
setLine(QLineF(x1, y1, x2, y2))
.
將項的鋼筆設為 pen 。若未設置鋼筆,將使用黑色 0 寬度實綫鋼筆繪製綫條。
另請參閱 pen ().
[虛擬]
QPainterPath
QGraphicsLineItem::
shape
() const
重實現自 QGraphicsItem::shape ().
[虛擬]
int
QGraphicsLineItem::
type
() const
重實現自 QGraphicsItem::type ().