PDA

View Full Version : Warning C4946: reinterpret_cast used between related classes when using qobject_cast



doberkofler
20th September 2010, 12:15
I'm consistently getting "warning C4946: reinterpret_cast used between related classes: 'QObject' and 'QLabel'" when compiling code like the following in VC7:



void myFunction(QWidget* theWidget)
{
QLabel* aLabel = qobject_cast<QLabel*>(theWidget);
if (aLabel)
{
...
}
}


I'm having a hard time to understand why qobject_cast would issues this warning and was hoping for some help to better understand what I'm doing/using wrong?

I (always) compile on the Windows platform with the -Wall and -WX options.