From eca658ab06eaaf477e6f1067878abfb90814d3c4 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 22 Jun 2005 15:21:26 +0000 Subject: [PATCH] Fix a bug: do not load default icon for the menu items which do not have any icons --- .../SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) 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 ); -- 2.39.2