Code as Fast as You Can Think
"I have only proved my code correct, not tested it" - Donald Knuth
Search This Blog
Tuesday, June 30, 2009
Qt qobject_cast advantage
qobject_cast is like dynamic_cast; it can cast object inherits from QObject.
The advantage is
qobject_cast does not require RTTI support
To use it, make sure Q_OBJECT macro is included. Or the return type is undefined.
StackedWidget *stackedWidget = qobject_cast
(parent());
if(stackedWidget != 0)
//do something
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
About Me
Unknown
View my complete profile
No comments:
Post a Comment