tools/designer/src/lib/shared/qdesigner_menu.cpp
changeset 18 2f34d5167611
parent 0 1918ee327afb
child 33 3e2da88830cd
--- a/tools/designer/src/lib/shared/qdesigner_menu.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/tools/designer/src/lib/shared/qdesigner_menu.cpp	Fri Apr 16 15:50:13 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -88,6 +88,7 @@
 
 QDesignerMenu::QDesignerMenu(QWidget *parent) :
     QMenu(parent),
+    m_subMenuPixmap(QPixmap(QLatin1String(":/trolltech/formeditor/images/submenu.png"))),
     m_currentIndex(0),
     m_addItem(new SpecialMenuAction(this)),
     m_addSeparator(new SpecialMenuAction(this)),
@@ -550,11 +551,10 @@
 
 QRect QDesignerMenu::subMenuPixmapRect(QAction *action) const
 {
-    static const QPixmap pm(QLatin1String(":/trolltech/formeditor/images/submenu.png"));
     const QRect g = actionGeometry(action);
-    const int x = layoutDirection() == Qt::LeftToRight ? (g.right() - pm.width() - 2) : 2;
-    const int y = g.top() + (g.height() - pm.height())/2 + 1;
-    return QRect(x, y, pm.width(), pm.height());
+    const int x = layoutDirection() == Qt::LeftToRight ? (g.right() - m_subMenuPixmap.width() - 2) : 2;
+    const int y = g.top() + (g.height() - m_subMenuPixmap.height())/2 + 1;
+    return QRect(x, y, m_subMenuPixmap.width(), m_subMenuPixmap.height());
 }
 
 bool QDesignerMenu::hasSubMenuPixmap(QAction *action) const
@@ -591,8 +591,7 @@
 
             p.fillRect(g, lg);
         } else if (hasSubMenuPixmap(a)) {
-            static const QPixmap pm(QLatin1String(":/trolltech/formeditor/images/submenu.png"));
-            p.drawPixmap(subMenuPixmapRect(a).topLeft(), pm);
+            p.drawPixmap(subMenuPixmapRect(a).topLeft(), m_subMenuPixmap);
         }
     }