QQnxWindow: use a proper cast
authorMarc Mutz <marc.mutz.qnx@kdab.com>
Fri, 28 Sep 2012 12:36:27 +0000 (14:36 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sat, 29 Sep 2012 09:05:48 +0000 (11:05 +0200)
Replace a C-cast with a const_cast.
Casting doesn't care about nullptr, so don't check for one.

Change-Id: I18a3e8f21d73b73385e567c7ceaf64e36aaa2cf3
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
src/plugins/platforms/qnx/qqnxwindow.cpp

index 42bc5b6..ed3fc5b 100644 (file)
@@ -519,10 +519,7 @@ void QQnxWindow::setParent(const QPlatformWindow *window)
 {
     qWindowDebug() << Q_FUNC_INFO << "window =" << this->window() << "platformWindow =" << window;
     // Cast away the const, we need to modify the hierarchy.
-    QQnxWindow *newParent = 0;
-
-    if (window)
-        newParent = static_cast<QQnxWindow*>((QPlatformWindow *)window);
+    QQnxWindow* const newParent = static_cast<QQnxWindow*>(const_cast<QPlatformWindow*>(window));
 
     if (newParent == m_parentWindow)
         return;