[Qt-interest] No RTTI information for QTreeWidgetItem

Scott Aron Bloom Scott.Bloom at sabgroup.com
Tue Jun 2 00:26:43 CEST 2009


No it wont.. I missed that...  

 

Instead do the following, make sure you set your Type during the
construction, and call QTreeWidgetItem::type() to figure out what type
of type it is

 

Scott

 

 

 

From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Eric Clark
Sent: Monday, June 01, 2009 2:08 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] No RTTI information for QTreeWidgetItem

 

Scott,

 

Thank you for the response, but I would not have a problem using
qobject_cast, except that QTreeWidgetItem does not inherit QObject. Will
qobject_cast work on non-QObjects?

 

Eric

 

From: Scott Aron Bloom [mailto:Scott.Bloom at sabgroup.com] 
Sent: Monday, June 01, 2009 4:04 PM
To: Eric Clark; qt-interest at trolltech.com
Subject: RE: [Qt-interest] No RTTI information for QTreeWidgetItem

 

Don't use RTTI on QT based objects... (in fact its rather unsafe when
crossing any DLL boundry on windows...) use qobject_cast

 

Scott

 

From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Eric Clark
Sent: Monday, June 01, 2009 1:05 PM
To: qt-interest at trolltech.com
Subject: [Qt-interest] No RTTI information for QTreeWidgetItem

 

Hello All,

 

I have a class that inherits QTreeWidgetItem. When I attempt to do a
dynamic_cast on a QTreeWidgetItem that was created using my subclass
BaseTreeWidgetItem I get an exception thrown by Microsoft C++ that says
the object is a __non_rtti_object. Has anyone seen this problem? If I
just cast the object instead of using a dynamic_cast everything works
just fine.

 

Thanks in advance!

Eric

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090601/ea50b26d/attachment.html 


More information about the Qt-interest-old mailing list