更详细的说明参看QGraphicsScene的文档,讲解很详细,看下面这段:
The scene's bounding rect is set by calling setSceneRect(). Items can be placed at any position on the scene, and the size of the scene is by default unlimited. The scene rect is used only for internal bookkeeping, maintaining the scene's item index. If the scene rect is unset, QGraphicsScene will use the bounding area of all items, as returned by itemsBoundingRect(), as the scene rect. However, itemsBoundingRect() is a relatively time consuming function, as it operates by collecting positional information for every item on the scene. Because of this, you should always set the scene rect when operating on large scenes.
QGraphicsSimpleTextItem provides a simple text label itemQGraphicsTextItem provides an advanced text browser item
这两个(反正第二个肯定可以的,第一个应该只是简单的lable),生成实例设置flag为Qt::TextEditorInteraction添加到screen就好了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)