MCPcopy Create free account
hub / github.com/cpvrlab/ImagePlay / addProcessItem

Method addProcessItem

ImagePlay/src/IPProcessList.cpp:64–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void IPProcessList::addProcessItem(QString processID, QString text, QString keywords, IPLProcess::IPLProcessCategory category)
65{
66 // load icon from png file and add background color based on the process category
67
68 QFileInfo iconFile(_mainWindow->processIconPath(processID));
69
70 if(!iconFile.exists())
71 {
72 iconFile = QFileInfo(_mainWindow->processIconPath("Plugin"));
73 }
74
75 QPixmap finalIcon(25,25);
76
77 if(iconFile.exists())
78 {
79 QPixmap transparentIcon(iconFile.absoluteFilePath());
80
81 QPainter painter(&finalIcon);
82 painter.fillRect(0,0,25,25,_categoryColors.at(category));
83 painter.drawPixmap(0,0,25,25,transparentIcon);
84 }
85
86 QListWidgetItem* newItem = new QListWidgetItem(finalIcon, text);
87 newItem->setToolTip(processID);
88 newItem->setStatusTip(keywords);
89 newItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled);
90
91 addItem(newItem);
92}
93
94void IPProcessList::startDrag(Qt::DropActions)
95{

Callers 1

initMethod · 0.80

Calls 2

processIconPathMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected