FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sqlitebrowser/src/IconCache.cpp at master · PeterDaveHello/sqlitebrowser · GitHub
PeterDaveHello
/
sqlitebrowser
Public
forked from
sqlitebrowser/sqlitebrowser
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
sqlitebrowser
/
src
/
IconCache.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (18 loc) · 731 Bytes
Breadcrumbs
sqlitebrowser
/
src
/
IconCache.cpp
Copy path
File metadata and controls
22 lines (18 loc) · 731 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#
include
"
IconCache.h
"
QIcon IconCache::null_icon;
std::unordered_map<std::string, QIcon> IconCache::icons;
const
QIcon&
IconCache::get
(
const
std::string& name)
{
//
Check if we already have an icon object with that name in the cache. If so, just return that
auto
it = icons.
find
(name);
if
(it != icons.
end
())
return
it->
second
;
//
If now, try to load an icon with that name and insert it into the cache
QIcon
icon
(
"
:/icons/
"
+
QString::fromStdString
(name));
auto
ins = icons.
insert
({name, icon});
//
If the insertion was successful, return the inserted icon object. If it was not, return a null icon.
if
(ins.
second
)
return
ins.
first
->
second
;
else
return
null_icon;
}
Back
|
FazBrowse Home
|
New Git URL