converted all calls to QIcon("somefile.png") into FilesDefs::getIconFromQtResourcePath("somefile.png") to save memory duplicated by Qt

This commit is contained in:
csoler 2020-08-15 22:17:52 +02:00
parent dcbcc95e41
commit 209355b9a5
63 changed files with 330 additions and 291 deletions

View file

@ -20,6 +20,7 @@
// This code is inspired from http://doc.qt.io/qt-5/qtwidgets-graphicsview-elasticnodes-node-cpp.html
#include "gui/common/FilesDefs.h"
#include <math.h>
#include <QApplication>
@ -366,11 +367,11 @@ void Node::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
QMenu contextMnu ;
if(_type == GraphWidget::ELASTIC_NODE_TYPE_FRIEND)
contextMnu.addAction(QIcon(IMAGE_DENIED), QObject::tr( "Deny friend" ), this, SLOT(denyFriend()) );
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_DENIED), QObject::tr( "Deny friend" ), this, SLOT(denyFriend()) );
else if(_type != GraphWidget::ELASTIC_NODE_TYPE_OWN)
contextMnu.addAction(QIcon(IMAGE_MAKEFRIEND), QObject::tr( "Make friend" ), this, SLOT(makeFriend()) );
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_MAKEFRIEND), QObject::tr( "Make friend" ), this, SLOT(makeFriend()) );
contextMnu.addAction(QIcon(IMAGE_MAKEFRIEND), QObject::tr( "Peer details" ), this, SLOT(peerDetails()) );
contextMnu.addAction(FilesDefs::getIconFromQtResourcePath(IMAGE_MAKEFRIEND), QObject::tr( "Peer details" ), this, SLOT(peerDetails()) );
contextMnu.exec(event->screenPos());
}