From: vsr Date: Wed, 22 Jun 2005 15:21:26 +0000 (+0000) Subject: Fix a bug: do not load default icon for the menu items which do not have any icons X-Git-Tag: T3_0_0_a4~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eca658ab06eaaf477e6f1067878abfb90814d3c4;p=modules%2Fgui.git Fix a bug: do not load default icon for the menu items which do not have any icons --- diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx index 7f377c5d7..ca6e68f02 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx @@ -1014,10 +1014,12 @@ void SALOME_PYQT_XmlHandler::createMenu( QDomNode& parentNode, const int parentM bool toggle = checkBool( attribute( elem, "toggle-id" ) ); QString execute = attribute( elem, "execute-action" ); // not used - QPixmap pixmap = myModule->getApp()->resourceMgr()->loadPixmap( myModule->name(""), icon ); QIconSet anIcon; - if ( !pixmap.isNull() ) - anIcon = QIconSet( pixmap ); + if ( !icon.isEmpty() ) { + QPixmap pixmap = myModule->getApp()->resourceMgr()->loadPixmap( myModule->name(""), icon ); + if ( !pixmap.isNull() ) + anIcon = QIconSet( pixmap ); + } // -1 action ID is not allowed : it means that attribute is missed in the XML file! // also check if the action with given ID is already created @@ -1088,10 +1090,12 @@ void SALOME_PYQT_XmlHandler::createToolBar( QDomNode& parentNode ) bool toggle = checkBool( attribute( elem, "toggle-id" ) ); QString execute = attribute( elem, "execute-action" ); // not used - QPixmap pixmap = myModule->getApp()->resourceMgr()->loadPixmap( myModule->name(""), icon ); QIconSet anIcon; - if ( !pixmap.isNull() ) - anIcon = QIconSet( pixmap ); + if ( !icon.isEmpty() ) { + QPixmap pixmap = myModule->getApp()->resourceMgr()->loadPixmap( myModule->name(""), icon ); + if ( !pixmap.isNull() ) + anIcon = QIconSet( pixmap ); + } // -1 action ID is not allowed : it means that attribute is missed in the XML file! // also check if the action with given ID is already created @@ -1151,10 +1155,12 @@ void SALOME_PYQT_XmlHandler::insertPopupItems( QDomNode& parentNode, QPopupMenu* bool toggle = checkBool( attribute( elem, "toggle-id" ) ); // not used QString execute = attribute( elem, "execute-action" ); // not used - QPixmap pixmap = myModule->getApp()->resourceMgr()->loadPixmap( myModule->name(""), icon ); QIconSet anIcon; - if ( !pixmap.isNull() ) - anIcon = QIconSet( pixmap ); + if ( !icon.isEmpty() ) { + QPixmap pixmap = myModule->getApp()->resourceMgr()->loadPixmap( myModule->name(""), icon ); + if ( !pixmap.isNull() ) + anIcon = QIconSet( pixmap ); + } // -1 action ID is not allowed : it means that attribute is missed in the XML file! // also check if the action with given ID is already created @@ -1169,10 +1175,12 @@ void SALOME_PYQT_XmlHandler::insertPopupItems( QDomNode& parentNode, QPopupMenu* QString label = attribute( elem, "label-id" ); QString icon = attribute( elem, "icon-id" ); - QPixmap pixmap = myModule->getApp()->resourceMgr()->loadPixmap( myModule->name(""), icon ); QIconSet anIcon; - if ( !pixmap.isNull() ) - anIcon = QIconSet( pixmap ); + if ( !icon.isEmpty() ) { + QPixmap pixmap = myModule->getApp()->resourceMgr()->loadPixmap( myModule->name(""), icon ); + if ( !pixmap.isNull() ) + anIcon = QIconSet( pixmap ); + } QPopupMenu* newPopup = new QPopupMenu( menu, label ); menu->insertItem( anIcon, label, newPopup, id, pos );