diff options
author | ConfuSomu | 2022-12-28 02:13:05 -0500 |
---|---|---|
committer | ConfuSomu | 2022-12-28 02:14:12 -0500 |
commit | c0cf3a1d0b4ff74ad43d0489631d4b9582b72d81 (patch) | |
tree | 5c0006237acc7abf795001ecdd32223cec9bc3ac /src/list_item.cpp | |
parent | 006d3cec6779ee85337bbabe02a6ff859d71f656 (diff) | |
download | ActorViewer-c0cf3a1d0b4ff74ad43d0489631d4b9582b72d81.tar ActorViewer-c0cf3a1d0b4ff74ad43d0489631d4b9582b72d81.tar.gz ActorViewer-c0cf3a1d0b4ff74ad43d0489631d4b9582b72d81.zip |
Only initialize each QIcon once
Diffstat (limited to 'src/list_item.cpp')
-rw-r--r-- | src/list_item.cpp | 9 |
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) : |