• 5176阅读
  • 0回复

QPointer 简单介绍 [复制链接]

上一主题 下一主题
离线zjhcool
 
只看楼主 倒序阅读 楼主  发表于: 2010-11-16
介绍这个是因为它少用,但不是不好用,因此谈谈它,以免被遗忘,还有个同是一家亲的QSharedPointer,还不了解,下次谈谈.
官方 Detailed Description
The QPointer class is a template class that provides guarded pointers to QObjects.
A guarded pointer, QPointer, behaves like a normal C++ pointer T *, except that itis automatically set to 0 when the referenced object is destroyed(unlike normal C++ pointers, which become “dangling pointers” in suchcases). T must be a subclass of QObject.
Guarded pointers are useful whenever you need to store a pointer to a QObject that is owned by someone else, and therefore might be destroyed while you still hold a reference to it. You can safely test the pointer for validity.

大体意思:QPointer,像一个正常的c++的指针T*。当参考对象被摧毁,他是自动置零。T必须是QObject的子类。
实例

....
...
.


标签: it, linux, QObject, QPointer, QSharedPointer, Qt
本文链接: QPointer 简单介绍
版权所有: Venus, 转载请注明来源Venus并保留链接地址!
我的博客地址: http://newfaction.net
快速回复
限100 字节
 
上一个 下一个