[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/kig/modes
From:       Pino Toscano <toscano.pino () tiscali ! it>
Date:       2007-03-31 22:58:13
Message-ID: 1175382003.532369.29711.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 648661 by pino:

- create the popup on the stack, at it's needed just in the function (and it isn't \
                leaked this way)
- use KIcon to properly load the icons


 M  +8 -12     label.cc  


--- trunk/KDE/kdeedu/kig/modes/label.cc #648660:648661
@@ -36,16 +36,14 @@
 #include "../objects/text_type.h"
 
 #include <qaction.h>
-#include <qcheckbox.h>
 #include <qevent.h>
 #include <qmenu.h>
 #include <qregexp.h>
-#include <qtextedit.h>
 #include <qvariant.h>
 
 #include <kcursor.h>
 #include <kdebug.h>
-#include <kiconloader.h>
+#include <kicon.h>
 #include <klocale.h>
 #include <kmessagebox.h>
 
@@ -164,9 +162,9 @@
      * are not children of the label
      */
     if ( prevlabel && isChild( o->calcer(), prevlabel ) ) break;
-    QMenu* p = new QMenu( v );
-    p->setObjectName( "text_label_select_arg_popup" );
-    QAction* act = p->addAction( i18n( "Name" ) );
+    QMenu p( v );
+    p.setObjectName( "text_label_select_arg_popup" );
+    QAction* act = p.addAction( i18n( "Name" ) );
     act->setData( QVariant::fromValue( 0 ) );
     QByteArrayList l = o->imp()->properties();
     assert( l.size() == o->imp()->numberOfProperties() );
@@ -176,17 +174,15 @@
       const char* iconfile = o->imp()->iconForProperty( i );
       if ( iconfile && *iconfile )
       {
-        QPixmap pix = mdoc.iconLoader()->loadIcon( iconfile, K3Icon::Small, 22, \
                K3Icon::DefaultState, 0L, true );
-        act = p->addAction( QIcon( pix ), s );
-        act->setData( QVariant::fromValue( i + 1 ) );
+        act = p.addAction( KIcon( QLatin1String( iconfile ), mdoc.iconLoader() ), s \
);  }
       else
       {
-        act = p->addAction( s );
-        act->setData( QVariant::fromValue( i + 1 ) );
+        act = p.addAction( s );
       };
+      act->setData( QVariant::fromValue( i + 1 ) );
     };
-    act = p->exec( v->mapToGlobal( d->plc ) );
+    act = p.exec( v->mapToGlobal( d->plc ) );
     if ( !act ) break;
     int result = act->data().toInt();
     ObjectCalcer::shared_ptr argcalcer;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic