aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorConfuSomu2022-12-28 02:13:05 -0500
committerConfuSomu2022-12-28 02:14:12 -0500
commitc0cf3a1d0b4ff74ad43d0489631d4b9582b72d81 (patch)
tree5c0006237acc7abf795001ecdd32223cec9bc3ac /src
parent006d3cec6779ee85337bbabe02a6ff859d71f656 (diff)
downloadActorViewer-c0cf3a1d0b4ff74ad43d0489631d4b9582b72d81.tar
ActorViewer-c0cf3a1d0b4ff74ad43d0489631d4b9582b72d81.tar.gz
ActorViewer-c0cf3a1d0b4ff74ad43d0489631d4b9582b72d81.zip
Only initialize each QIcon once
Diffstat (limited to 'src')
-rw-r--r--src/list_item.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/list_item.cpp b/src/list_item.cpp
index 6409169..a7fde7e 100644
--- a/src/list_item.cpp
+++ b/src/list_item.cpp
@@ -2,7 +2,14 @@
#include "types.h"
QIcon* choose_icon(StatusType status_type) {
- return new QIcon(); // TODO: null icon for the moment
+ // via the use of `static' in the following switch block, the idea is to only initialize each QIcon type once in the program's lifetime.
+
+ switch (status_type) {
+ // TODO: only null icon for the moment
+ default:
+ static QIcon* icon = new QIcon();
+ return icon;
+ }
}
ListItem::ListItem(const QString &text, StatusType status_type, QListWidget *parent, int index) :