OSDN Git Service

A minor optimization for Manhattanstyle
authorJens Bache-Wiig <jbache@trolltech.com>
Thu, 29 Apr 2010 17:11:07 +0000 (19:11 +0200)
committerJens Bache-Wiig <jbache@trolltech.com>
Thu, 29 Apr 2010 17:11:07 +0000 (19:11 +0200)
We don't need the qobject cast. Checking the widget flag
should be a bit faster.

Done-with: danimo

src/plugins/coreplugin/manhattanstyle.cpp

index 5f2bc9c..7d63911 100644 (file)
@@ -40,7 +40,6 @@
 
 #include <QtGui/QApplication>
 #include <QtGui/QComboBox>
-#include <QtGui/QDialog>
 #include <QtGui/QDialogButtonBox>
 #include <QtGui/QDockWidget>
 #include <QtGui/QLabel>
@@ -84,7 +83,7 @@ bool panelWidget(const QWidget *widget)
         return false;
 
     // Do not style dialogs or explicitly ignored widgets
-    if (qobject_cast<const QDialog *>(widget->window()))
+    if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog)
         return false;
 
     if (qobject_cast<const Utils::FancyMainWindow *>(widget))
@@ -112,7 +111,7 @@ bool lightColored(const QWidget *widget)
         return false;
 
     // Don't style dialogs or explicitly ignored widgets
-    if (qobject_cast<const QDialog *>(widget->window()))
+    if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog)
         return false;
 
     const QWidget *p = widget;