事实上场景缩放,注解的显示既不会变大变小,也不会消失。
我在Qt4.3.5,RedHat 9下编译运行的结果是,缩放场景到一定程度后注解会出现或消失,如同书中所说,有个阈值。
void QGraphicsItem::setFlag ( GraphicsItemFlag flag, bool enabled = true )
If enabled is true, the item flag flag is enabled; otherwise, it is disabled.
QGraphicsItem::ItemIgnoresTransformations
The item ignores inherited transformations (i.e., its position is still relative to its parent, but the parent or view rotation, zoom or shear transformations are ignored). This flag is particularly useful for text label items, which can become unreadable when the view zooms away from the scene. By default, this flag is disabled. This flag was introduced in Qt 4.3.
根据英文文档的说明,setFlag第一个参数表明忽略继承的缩放;而paint槽option的levelOfDetail,应该是由所在场景传递过去的,而非来自自己。项--视图 的思想还需要好好理解。