diff options
Diffstat (limited to 'applications')
-rw-r--r-- | applications/kube/main.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/applications/kube/main.cpp b/applications/kube/main.cpp index 03a128c4..ad7bac88 100644 --- a/applications/kube/main.cpp +++ b/applications/kube/main.cpp | |||
@@ -27,8 +27,18 @@ public: | |||
27 | } | 27 | } |
28 | const auto icon = QIcon::fromTheme(id); | 28 | const auto icon = QIcon::fromTheme(id); |
29 | auto expectedSize = requestedSize; | 29 | auto expectedSize = requestedSize; |
30 | if (!icon.availableSizes().contains(requestedSize) && !icon.availableSizes().isEmpty()) { | 30 | //Get the largest size that is still smaller or equal than requested |
31 | expectedSize = icon.availableSizes().first(); | 31 | //Except if we only have larger sizes, then just pick the closest one |
32 | bool first = true; | ||
33 | for (const auto s : icon.availableSizes()) { | ||
34 | if (first && s.width() > requestedSize.width()) { | ||
35 | expectedSize = s; | ||
36 | break; | ||
37 | } | ||
38 | first = false; | ||
39 | if (s.width() <= requestedSize.width()) { | ||
40 | expectedSize = s; | ||
41 | } | ||
32 | } | 42 | } |
33 | const auto pixmap = icon.pixmap(expectedSize); | 43 | const auto pixmap = icon.pixmap(expectedSize); |
34 | if (size) { | 44 | if (size) { |