QGraphicsScene[通俗易懂]

QGraphicsScene[通俗易懂]#includeQGraphicsScenehasnovisualappearanceofitsown;itonlymanagestheitems.创建QGraphicsScene:QGraphicsScene::QGraphicsScene(QObject*parent=0)QGraphicsScene::QGraphicsScene(constQRectF&sceneRect,QObject*parent=0)QGraph

大家好,欢迎来到IT知识分享网。

#include

QGraphicsScene has no visual appearance of its own; it only manages the items.

创建QGraphicsScene:

QGraphicsScene::QGraphicsScene ( QObject * parent = 0 )

QGraphicsScene::QGraphicsScene ( const QRectF & sceneRect, QObject * parent = 0 )

QGraphicsScene::QGraphicsScene ( qreal x, qreal y, qreal width, qreal height, QObject * parent = 0 )

 

销毁:

QGraphicsScene::~QGraphicsScene ()  [virtual]

 

添加item:

addItem() or addEllipse(), addLine(), addPath(), addPixmap(), addPolygon(), addRect(), addText()

change:changed()

remove:removeItem().

rect:1,setSceneRect().2,itemsBoundingRect()——默认的rect是无限大的,如果不进行设定当需要rect的时候就会调用itemsBoundingRect()这个是遍历每个item来取得scene的rect所以,为了快速最好还是事先设定好rect

location:items(),itemAt(),

selection:setSelectionArea(),clearSelection().selectedItems()

event:setFocusItem(),QGraphicsItem::setFocus().focusItem() setFocus() clearFocus() hasFocus()

enum QGraphicsScene::ItemIndexMethod——设置二叉树的

enum QGraphicsScene::SceneLayer——分3层
flags QGraphicsScene::SceneLayers

属性:

backgroundBrush: QBrush

Access functions:

QBrush backgroundBrush () const

void setBackgroundBrush ( const QBrush & brush )

 

bspTreeDepth : int

Access functions:

int bspTreeDepth () const

void setBspTreeDepth ( int depth )

在采用BSP遍历的时候要指定深度,如果不设定这个属性会影响效率

 

font : QFont

Access functions:

QFont font () const

void setFont ( const QFont & font )

 

foregroundBrush : QBrush

Access functions:

QBrush foregroundBrush () const

void setForegroundBrush ( const QBrush & brush )

 

itemIndexMethod : ItemIndexMethod

Access functions:

ItemIndexMethod itemIndexMethod () const

void setItemIndexMethod ( ItemIndexMethod method )

 

palette : QPalette

Access functions:

QPalette palette () const

void setPalette ( const QPalette & palette )

 

sceneRect : QRectF

Access functions:

QRectF sceneRect () const

void setSceneRect ( const QRectF & rect )

void setSceneRect ( qreal x, qreal y, qreal w, qreal h )

 

stickyFocus : bool

Access functions:

bool stickyFocus () const

void setStickyFocus ( bool enabled )

 

QGraphicsItem * QGraphicsScene::activePanel () const

QGraphicsItem * QGraphicsScene::focusItem () const

QGraphicsItem * QGraphicsScene::itemAt ( const QPointF & position, const QTransform & deviceTransform ) const

QGraphicsItem * QGraphicsScene::itemAt ( qreal x, qreal y, const QTransform & deviceTransform ) const

QList<QGraphicsItem *> QGraphicsScene::selectedItems () const

QList<QGraphicsItem *> QGraphicsScene::items () const

QList<QGraphicsItem *> QGraphicsScene::items ( Qt::SortOrder order ) const

QList<QGraphicsItem *> QGraphicsScene::items ( const QPointF & pos, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform & deviceTransform = QTransform() ) const

QList<QGraphicsItem *> QGraphicsScene::items ( qreal x, qreal y, qreal w, qreal h, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform & deviceTransform = QTransform() ) const

QList<QGraphicsItem *> QGraphicsScene::items ( const QRectF & rect, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform & deviceTransform = QTransform() ) const

QList<QGraphicsItem *> QGraphicsScene::items ( const QPolygonF & polygon, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform & deviceTransform = QTransform() ) const

QList<QGraphicsItem *> QGraphicsScene::items ( const QPainterPath & path, Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform & deviceTransform = QTransform() ) const

void QGraphicsScene::render ( QPainter * painter, const QRectF & target = QRectF(), const QRectF & source = QRectF(), Qt::AspectRatioMode aspectRatioMode = Qt::KeepAspectRatio )

void QGraphicsScene::sceneRectChanged ( const QRectF & rect [signal]

QPainterPath QGraphicsScene::selectionArea () const

void QGraphicsScene::setActivePanel ( QGraphicsItem * item )

QGraphicsWidget * QGraphicsScene::activeWindow () const

void QGraphicsScene::setActiveWindow ( QGraphicsWidget * widget )

void QGraphicsScene::advance ()  [slot]

void QGraphicsScene::changed ( const QList<QRectF> & region [signal]

void QGraphicsScene::clearFocus ()

void QGraphicsScene::clearSelection ()  [slot]

QList<QGraphicsItem *> QGraphicsScene::collidingItems ( const QGraphicsItem * item, Qt::ItemSelectionMode mode = Qt::IntersectsItemShape ) const

void QGraphicsScene::contextMenuEvent ( QGraphicsSceneContextMenuEvent * contextMenuEvent [virtual protected]

QGraphicsItemGroup * QGraphicsScene::createItemGroup ( const QList<QGraphicsItem *> & items )

void QGraphicsScene::destroyItemGroup ( QGraphicsItemGroup * group )

bool QGraphicsScene::event ( QEvent * event [virtual protected]

bool QGraphicsScene::eventFilter ( QObject * watched, QEvent * event [virtual protected]

void QGraphicsScene::focusInEvent ( QFocusEvent * focusEvent [virtual protected]

bool QGraphicsScene::focusNextPrevChild ( bool next [protected slot]

void QGraphicsScene::focusOutEvent ( QFocusEvent * focusEvent [virtual protected]

bool QGraphicsScene::hasFocus () const

void QGraphicsScene::inputMethodEvent ( QInputMethodEvent * event [virtual protected]

QVariant QGraphicsScene::inputMethodQuery ( Qt::InputMethodQuery query ) const  [virtual]

void QGraphicsScene::invalidate ( const QRectF & rect = QRectF(), SceneLayers layers = AllLayers )  [slot]

void QGraphicsScene::invalidate ( qreal x, qreal y, qreal w, qreal h, SceneLayers layers = AllLayers )

bool QGraphicsScene::isActive () const

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/7590.html

(0)
上一篇 2023-01-05 17:42
下一篇 2023-01-05 17:43

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信