| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | static QBasicAtomicInt serialNumCounter = { (1) }; | - |
| 11 | | - |
| 12 | static void qt_cleanup_icon_cache(); | - |
| 13 | namespace { | - |
| 14 | struct IconCache : public QCache<QString, QIcon> | - |
| 15 | { | - |
| 16 | IconCache() | - |
| 17 | { | - |
| 18 | | - |
| 19 | qAddPostRoutine(qt_cleanup_icon_cache); | - |
| 20 | } executed: }Execution Count:1 | 1 |
| 21 | }; | - |
| 22 | } | - |
| 23 | | - |
| 24 | static IconCache *qtIconCache() { static QGlobalStatic<IconCache > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { IconCache *x = new IconCache; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<IconCache > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:21 partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:1 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:1 | yes Evaluation Count:20 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-21 |
| 25 | | - |
| 26 | static void qt_cleanup_icon_cache() | - |
| 27 | { | - |
| 28 | qtIconCache()->clear(); | - |
| 29 | } executed: }Execution Count:1 | 1 |
| 30 | | - |
| 31 | QIconPrivate::QIconPrivate() | - |
| 32 | : engine(0), ref(1), | - |
| 33 | serialNum(serialNumCounter.fetchAndAddRelaxed(1)), | - |
| 34 | detach_no(0) | - |
| 35 | { | - |
| 36 | } executed: }Execution Count:4542 | 4542 |
| 37 | | - |
| 38 | QPixmapIconEngine::QPixmapIconEngine() | - |
| 39 | { | - |
| 40 | } | - |
| 41 | | - |
| 42 | QPixmapIconEngine::QPixmapIconEngine(const QPixmapIconEngine &other) | - |
| 43 | : QIconEngine(other), pixmaps(other.pixmaps) | - |
| 44 | { | - |
| 45 | } executed: }Execution Count:5 | 5 |
| 46 | | - |
| 47 | QPixmapIconEngine::~QPixmapIconEngine() | - |
| 48 | { | - |
| 49 | } | - |
| 50 | | - |
| 51 | void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) | - |
| 52 | { | - |
| 53 | QSize pixmapSize = rect.size(); | - |
| 54 | | - |
| 55 | | - |
| 56 | | - |
| 57 | painter->drawPixmap(rect, pixmap(pixmapSize, mode, state)); | - |
| 58 | } executed: }Execution Count:2587 | 2587 |
| 59 | | - |
| 60 | static inline int area(const QSize &s) { return s.width() * s.height(); } executed: return s.width() * s.height();Execution Count:211485 | 211485 |
| 61 | | - |
| 62 | | - |
| 63 | static QPixmapIconEngineEntry *bestSizeMatch( const QSize &size, QPixmapIconEngineEntry *pa, QPixmapIconEngineEntry *pb) | - |
| 64 | { | - |
| 65 | int s = area(size); | - |
| 66 | if (pa->size == QSize() && pa->pixmap.isNull()) { partially evaluated: pa->size == QSize()| no Evaluation Count:0 | yes Evaluation Count:70495 |
never evaluated: pa->pixmap.isNull() | 0-70495 |
| 67 | pa->pixmap = QPixmap(pa->fileName); | - |
| 68 | pa->size = pa->pixmap.size(); | - |
| 69 | } | 0 |
| 70 | int a = area(pa->size); | - |
| 71 | if (pb->size == QSize() && pb->pixmap.isNull()) { partially evaluated: pb->size == QSize()| no Evaluation Count:0 | yes Evaluation Count:70495 |
never evaluated: pb->pixmap.isNull() | 0-70495 |
| 72 | pb->pixmap = QPixmap(pb->fileName); | - |
| 73 | pb->size = pb->pixmap.size(); | - |
| 74 | } | 0 |
| 75 | int b = area(pb->size); | - |
| 76 | int res = a; | - |
| 77 | if (qMin(a,b) >= s) evaluated: qMin(a,b) >= s| yes Evaluation Count:69486 | yes Evaluation Count:1009 |
| 1009-69486 |
| 78 | res = qMin(a,b); executed: res = qMin(a,b);Execution Count:69486 | 69486 |
| 79 | else | - |
| 80 | res = qMax(a,b); executed: res = qMax(a,b);Execution Count:1009 | 1009 |
| 81 | if (res == a) evaluated: res == a| yes Evaluation Count:1015 | yes Evaluation Count:69480 |
| 1015-69480 |
| 82 | return pa; executed: return pa;Execution Count:1015 | 1015 |
| 83 | return pb; executed: return pb;Execution Count:69480 | 69480 |
| 84 | } | - |
| 85 | | - |
| 86 | QPixmapIconEngineEntry *QPixmapIconEngine::tryMatch(const QSize &size, QIcon::Mode mode, QIcon::State state) | - |
| 87 | { | - |
| 88 | QPixmapIconEngineEntry *pe = 0; | - |
| 89 | for (int i = 0; i < pixmaps.count(); ++i) evaluated: i < pixmaps.count()| yes Evaluation Count:132733 | yes Evaluation Count:47108 |
| 47108-132733 |
| 90 | if (pixmaps.at(i).mode == mode && pixmaps.at(i).state == state) { evaluated: pixmaps.at(i).mode == mode| yes Evaluation Count:131168 | yes Evaluation Count:1565 |
evaluated: pixmaps.at(i).state == state| yes Evaluation Count:114691 | yes Evaluation Count:16477 |
| 1565-131168 |
| 91 | if (pe) evaluated: pe| yes Evaluation Count:70495 | yes Evaluation Count:44196 |
| 44196-70495 |
| 92 | pe = bestSizeMatch(size, &pixmaps[i], pe); executed: pe = bestSizeMatch(size, &pixmaps[i], pe);Execution Count:70495 | 70495 |
| 93 | else | - |
| 94 | pe = &pixmaps[i]; executed: pe = &pixmaps[i];Execution Count:44196 | 44196 |
| 95 | } | - |
| 96 | return pe; executed: return pe;Execution Count:47108 | 47108 |
| 97 | } | - |
| 98 | | - |
| 99 | | - |
| 100 | QPixmapIconEngineEntry *QPixmapIconEngine::bestMatch(const QSize &size, QIcon::Mode mode, QIcon::State state, bool sizeOnly) | - |
| 101 | { | - |
| 102 | QPixmapIconEngineEntry *pe = tryMatch(size, mode, state); | - |
| 103 | while (!pe){ evaluated: !pe| yes Evaluation Count:227 | yes Evaluation Count:43962 |
| 227-43962 |
| 104 | QIcon::State oppositeState = (state == QIcon::On) ? QIcon::Off : QIcon::On; evaluated: (state == QIcon::On)| yes Evaluation Count:58 | yes Evaluation Count:169 |
| 58-169 |
| 105 | if (mode == QIcon::Disabled || mode == QIcon::Selected) { evaluated: mode == QIcon::Disabled| yes Evaluation Count:81 | yes Evaluation Count:146 |
evaluated: mode == QIcon::Selected| yes Evaluation Count:85 | yes Evaluation Count:61 |
| 61-146 |
| 106 | QIcon::Mode oppositeMode = (mode == QIcon::Disabled) ? QIcon::Selected : QIcon::Disabled; evaluated: (mode == QIcon::Disabled)| yes Evaluation Count:81 | yes Evaluation Count:85 |
| 81-85 |
| 107 | if ((pe = tryMatch(size, QIcon::Normal, state))) evaluated: (pe = tryMatch(size, QIcon::Normal, state))| yes Evaluation Count:142 | yes Evaluation Count:24 |
| 24-142 |
| 108 | break; executed: break;Execution Count:142 | 142 |
| 109 | if ((pe = tryMatch(size, QIcon::Active, state))) evaluated: (pe = tryMatch(size, QIcon::Active, state))| yes Evaluation Count:4 | yes Evaluation Count:20 |
| 4-20 |
| 110 | break; executed: break;Execution Count:4 | 4 |
| 111 | if ((pe = tryMatch(size, mode, oppositeState))) evaluated: (pe = tryMatch(size, mode, oppositeState))| yes Evaluation Count:4 | yes Evaluation Count:16 |
| 4-16 |
| 112 | break; executed: break;Execution Count:4 | 4 |
| 113 | if ((pe = tryMatch(size, QIcon::Normal, oppositeState))) evaluated: (pe = tryMatch(size, QIcon::Normal, oppositeState))| yes Evaluation Count:4 | yes Evaluation Count:12 |
| 4-12 |
| 114 | break; executed: break;Execution Count:4 | 4 |
| 115 | if ((pe = tryMatch(size, QIcon::Active, oppositeState))) evaluated: (pe = tryMatch(size, QIcon::Active, oppositeState))| yes Evaluation Count:4 | yes Evaluation Count:8 |
| 4-8 |
| 116 | break; executed: break;Execution Count:4 | 4 |
| 117 | if ((pe = tryMatch(size, oppositeMode, state))) evaluated: (pe = tryMatch(size, oppositeMode, state))| yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
| 118 | break; executed: break;Execution Count:4 | 4 |
| 119 | if ((pe = tryMatch(size, oppositeMode, oppositeState))) partially evaluated: (pe = tryMatch(size, oppositeMode, oppositeState))| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 120 | break; executed: break;Execution Count:4 | 4 |
| 121 | } else { | 0 |
| 122 | QIcon::Mode oppositeMode = (mode == QIcon::Normal) ? QIcon::Active : QIcon::Normal; evaluated: (mode == QIcon::Normal)| yes Evaluation Count:44 | yes Evaluation Count:17 |
| 17-44 |
| 123 | if ((pe = tryMatch(size, oppositeMode, state))) evaluated: (pe = tryMatch(size, oppositeMode, state))| yes Evaluation Count:7 | yes Evaluation Count:54 |
| 7-54 |
| 124 | break; executed: break;Execution Count:7 | 7 |
| 125 | if ((pe = tryMatch(size, mode, oppositeState))) evaluated: (pe = tryMatch(size, mode, oppositeState))| yes Evaluation Count:34 | yes Evaluation Count:20 |
| 20-34 |
| 126 | break; executed: break;Execution Count:34 | 34 |
| 127 | if ((pe = tryMatch(size, oppositeMode, oppositeState))) evaluated: (pe = tryMatch(size, oppositeMode, oppositeState))| yes Evaluation Count:4 | yes Evaluation Count:16 |
| 4-16 |
| 128 | break; executed: break;Execution Count:4 | 4 |
| 129 | if ((pe = tryMatch(size, QIcon::Disabled, state))) evaluated: (pe = tryMatch(size, QIcon::Disabled, state))| yes Evaluation Count:4 | yes Evaluation Count:12 |
| 4-12 |
| 130 | break; executed: break;Execution Count:4 | 4 |
| 131 | if ((pe = tryMatch(size, QIcon::Selected, state))) evaluated: (pe = tryMatch(size, QIcon::Selected, state))| yes Evaluation Count:4 | yes Evaluation Count:8 |
| 4-8 |
| 132 | break; executed: break;Execution Count:4 | 4 |
| 133 | if ((pe = tryMatch(size, QIcon::Disabled, oppositeState))) evaluated: (pe = tryMatch(size, QIcon::Disabled, oppositeState))| yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
| 134 | break; executed: break;Execution Count:4 | 4 |
| 135 | if ((pe = tryMatch(size, QIcon::Selected, oppositeState))) partially evaluated: (pe = tryMatch(size, QIcon::Selected, oppositeState))| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 136 | break; executed: break;Execution Count:4 | 4 |
| 137 | } | 0 |
| 138 | | - |
| 139 | if (!pe) | 0 |
| 140 | return pe; never executed: return pe; | 0 |
| 141 | } | 0 |
| 142 | | - |
| 143 | if (sizeOnly ? (pe->size.isNull() || !pe->size.isValid()) : pe->pixmap.isNull()) { evaluated: sizeOnly| yes Evaluation Count:39985 | yes Evaluation Count:4204 |
| 4204-39985 |
| 144 | pe->pixmap = QPixmap(pe->fileName); | - |
| 145 | if (!pe->pixmap.isNull()) evaluated: !pe->pixmap.isNull()| yes Evaluation Count:330 | yes Evaluation Count:6 |
| 6-330 |
| 146 | pe->size = pe->pixmap.size(); executed: pe->size = pe->pixmap.size();Execution Count:330 | 330 |
| 147 | } executed: }Execution Count:336 | 336 |
| 148 | | - |
| 149 | return pe; executed: return pe;Execution Count:44189 | 44189 |
| 150 | } | - |
| 151 | | - |
| 152 | QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) | - |
| 153 | { | - |
| 154 | QPixmap pm; | - |
| 155 | QPixmapIconEngineEntry *pe = bestMatch(size, mode, state, false); | - |
| 156 | if (pe) partially evaluated: pe| yes Evaluation Count:4204 | no Evaluation Count:0 |
| 0-4204 |
| 157 | pm = pe->pixmap; executed: pm = pe->pixmap;Execution Count:4204 | 4204 |
| 158 | | - |
| 159 | if (pm.isNull()) { evaluated: pm.isNull()| yes Evaluation Count:2 | yes Evaluation Count:4202 |
| 2-4202 |
| 160 | int idx = pixmaps.count(); | - |
| 161 | while (--idx >= 0) { partially evaluated: --idx >= 0| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 162 | if (pe == &pixmaps[idx]) { partially evaluated: pe == &pixmaps[idx]| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 163 | pixmaps.remove(idx); | - |
| 164 | break; executed: break;Execution Count:2 | 2 |
| 165 | } | - |
| 166 | } | 0 |
| 167 | if (pixmaps.isEmpty()) evaluated: pixmaps.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 168 | return pm; executed: return pm;Execution Count:1 | 1 |
| 169 | else | - |
| 170 | return pixmap(size, mode, state); executed: return pixmap(size, mode, state);Execution Count:1 | 1 |
| 171 | } | - |
| 172 | | - |
| 173 | QSize actualSize = pm.size(); | - |
| 174 | if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height())) partially evaluated: !actualSize.isNull()| yes Evaluation Count:4202 | no Evaluation Count:0 |
evaluated: actualSize.width() > size.width()| yes Evaluation Count:305 | yes Evaluation Count:3897 |
evaluated: actualSize.height() > size.height()| yes Evaluation Count:5 | yes Evaluation Count:3892 |
| 0-4202 |
| 175 | actualSize.scale(size, Qt::KeepAspectRatio); executed: actualSize.scale(size, Qt::KeepAspectRatio);Execution Count:310 | 310 |
| 176 | | - |
| 177 | QString key = QLatin1String("qt_") | - |
| 178 | % HexString<quint64>(pm.cacheKey()) | - |
| 179 | % HexString<uint>(pe->mode) | - |
| 180 | % HexString<quint64>(QGuiApplication::palette().cacheKey()) | - |
| 181 | % HexString<uint>(actualSize.width()) | - |
| 182 | % HexString<uint>(actualSize.height()); | - |
| 183 | | - |
| 184 | if (mode == QIcon::Active) { evaluated: mode == QIcon::Active| yes Evaluation Count:19 | yes Evaluation Count:4183 |
| 19-4183 |
| 185 | if (QPixmapCache::find(key % HexString<uint>(mode), pm)) evaluated: QPixmapCache::find(key % HexString<uint>(mode), pm)| yes Evaluation Count:4 | yes Evaluation Count:15 |
| 4-15 |
| 186 | return pm; executed: return pm;Execution Count:4 | 4 |
| 187 | if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), pm)) { evaluated: QPixmapCache::find(key % HexString<uint>(QIcon::Normal), pm)| yes Evaluation Count:11 | yes Evaluation Count:4 |
| 4-11 |
| 188 | QPixmap active = pm; | - |
| 189 | if (QGuiApplication *guiApp = qobject_cast<QGuiApplication *>((static_cast<QGuiApplication *>(QCoreApplication::instance())))) partially evaluated: QGuiApplication *guiApp = qobject_cast<QGuiApplication *>((static_cast<QGuiApplication *>(QCoreApplication::instance())))| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 190 | active = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(guiApp))->applyQIconStyleHelper(QIcon::Active, pm); executed: active = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(guiApp))->applyQIconStyleHelper(QIcon::Active, pm);Execution Count:11 | 11 |
| 191 | if (pm.cacheKey() == active.cacheKey()) partially evaluated: pm.cacheKey() == active.cacheKey()| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 192 | return pm; executed: return pm;Execution Count:11 | 11 |
| 193 | } | 0 |
| 194 | } executed: }Execution Count:4 | 4 |
| 195 | | - |
| 196 | if (!QPixmapCache::find(key % HexString<uint>(mode), pm)) { evaluated: !QPixmapCache::find(key % HexString<uint>(mode), pm)| yes Evaluation Count:1168 | yes Evaluation Count:3019 |
| 1168-3019 |
| 197 | if (pm.size() != actualSize) evaluated: pm.size() != actualSize| yes Evaluation Count:87 | yes Evaluation Count:1081 |
| 87-1081 |
| 198 | pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); executed: pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);Execution Count:87 | 87 |
| 199 | if (pe->mode != mode && mode != QIcon::Normal) { evaluated: pe->mode != mode| yes Evaluation Count:40 | yes Evaluation Count:1128 |
evaluated: mode != QIcon::Normal| yes Evaluation Count:34 | yes Evaluation Count:6 |
| 6-1128 |
| 200 | QPixmap generated = pm; | - |
| 201 | if (QGuiApplication *guiApp = qobject_cast<QGuiApplication *>((static_cast<QGuiApplication *>(QCoreApplication::instance())))) partially evaluated: QGuiApplication *guiApp = qobject_cast<QGuiApplication *>((static_cast<QGuiApplication *>(QCoreApplication::instance())))| yes Evaluation Count:34 | no Evaluation Count:0 |
| 0-34 |
| 202 | generated = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(guiApp))->applyQIconStyleHelper(mode, pm); executed: generated = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(guiApp))->applyQIconStyleHelper(mode, pm);Execution Count:34 | 34 |
| 203 | if (!generated.isNull()) partially evaluated: !generated.isNull()| yes Evaluation Count:34 | no Evaluation Count:0 |
| 0-34 |
| 204 | pm = generated; executed: pm = generated;Execution Count:34 | 34 |
| 205 | } executed: }Execution Count:34 | 34 |
| 206 | QPixmapCache::insert(key % HexString<uint>(mode), pm); | - |
| 207 | } executed: }Execution Count:1168 | 1168 |
| 208 | return pm; executed: return pm;Execution Count:4187 | 4187 |
| 209 | } | - |
| 210 | | - |
| 211 | QSize QPixmapIconEngine::actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) | - |
| 212 | { | - |
| 213 | QSize actualSize; | - |
| 214 | if (QPixmapIconEngineEntry *pe = bestMatch(size, mode, state, true)) partially evaluated: QPixmapIconEngineEntry *pe = bestMatch(size, mode, state, true)| yes Evaluation Count:39985 | no Evaluation Count:0 |
| 0-39985 |
| 215 | actualSize = pe->size; executed: actualSize = pe->size;Execution Count:39985 | 39985 |
| 216 | | - |
| 217 | if (actualSize.isNull()) partially evaluated: actualSize.isNull()| no Evaluation Count:0 | yes Evaluation Count:39985 |
| 0-39985 |
| 218 | return actualSize; never executed: return actualSize; | 0 |
| 219 | | - |
| 220 | if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height())) partially evaluated: !actualSize.isNull()| yes Evaluation Count:39985 | no Evaluation Count:0 |
evaluated: actualSize.width() > size.width()| yes Evaluation Count:479 | yes Evaluation Count:39506 |
evaluated: actualSize.height() > size.height()| yes Evaluation Count:5 | yes Evaluation Count:39501 |
| 0-39985 |
| 221 | actualSize.scale(size, Qt::KeepAspectRatio); executed: actualSize.scale(size, Qt::KeepAspectRatio);Execution Count:484 | 484 |
| 222 | return actualSize; executed: return actualSize;Execution Count:39985 | 39985 |
| 223 | } | - |
| 224 | | - |
| 225 | void QPixmapIconEngine::addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state) | - |
| 226 | { | - |
| 227 | if (!pixmap.isNull()) { partially evaluated: !pixmap.isNull()| yes Evaluation Count:2494 | no Evaluation Count:0 |
| 0-2494 |
| 228 | QPixmapIconEngineEntry *pe = tryMatch(pixmap.size(), mode, state); | - |
| 229 | if(pe && pe->size == pixmap.size()) { evaluated: pe| yes Evaluation Count:7 | yes Evaluation Count:2487 |
partially evaluated: pe->size == pixmap.size()| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-2487 |
| 230 | pe->pixmap = pixmap; | - |
| 231 | pe->fileName.clear(); | - |
| 232 | } else { | 0 |
| 233 | pixmaps += QPixmapIconEngineEntry(pixmap, mode, state); | - |
| 234 | } executed: }Execution Count:2494 | 2494 |
| 235 | } | - |
| 236 | } executed: }Execution Count:2494 | 2494 |
| 237 | | - |
| 238 | void QPixmapIconEngine::addFile(const QString &fileName, const QSize &_size, QIcon::Mode mode, QIcon::State state) | - |
| 239 | { | - |
| 240 | if (!fileName.isEmpty()) { partially evaluated: !fileName.isEmpty()| yes Evaluation Count:6980 | no Evaluation Count:0 |
| 0-6980 |
| 241 | QSize size = _size; | - |
| 242 | QPixmap pixmap; | - |
| 243 | | - |
| 244 | QString abs = fileName; | - |
| 245 | if (fileName.at(0) != QLatin1Char(':')) evaluated: fileName.at(0) != QLatin1Char(':')| yes Evaluation Count:26 | yes Evaluation Count:6954 |
| 26-6954 |
| 246 | abs = QFileInfo(fileName).absoluteFilePath(); executed: abs = QFileInfo(fileName).absoluteFilePath();Execution Count:26 | 26 |
| 247 | | - |
| 248 | for (int i = 0; i < pixmaps.count(); ++i) { evaluated: i < pixmaps.count()| yes Evaluation Count:10705 | yes Evaluation Count:6980 |
| 6980-10705 |
| 249 | if (pixmaps.at(i).mode == mode && pixmaps.at(i).state == state) { evaluated: pixmaps.at(i).mode == mode| yes Evaluation Count:10692 | yes Evaluation Count:13 |
evaluated: pixmaps.at(i).state == state| yes Evaluation Count:6657 | yes Evaluation Count:4035 |
| 13-10692 |
| 250 | QPixmapIconEngineEntry *pe = &pixmaps[i]; | - |
| 251 | if(size == QSize()) { evaluated: size == QSize()| yes Evaluation Count:5 | yes Evaluation Count:6652 |
| 5-6652 |
| 252 | pixmap = QPixmap(abs); | - |
| 253 | size = pixmap.size(); | - |
| 254 | } executed: }Execution Count:5 | 5 |
| 255 | if (pe->size == QSize() && pe->pixmap.isNull()) { evaluated: pe->size == QSize()| yes Evaluation Count:900 | yes Evaluation Count:5757 |
partially evaluated: pe->pixmap.isNull()| yes Evaluation Count:900 | no Evaluation Count:0 |
| 0-5757 |
| 256 | pe->pixmap = QPixmap(pe->fileName); | - |
| 257 | pe->size = pe->pixmap.size(); | - |
| 258 | } executed: }Execution Count:900 | 900 |
| 259 | if(pe->size == size) { partially evaluated: pe->size == size| no Evaluation Count:0 | yes Evaluation Count:6657 |
| 0-6657 |
| 260 | pe->pixmap = pixmap; | - |
| 261 | pe->fileName = abs; | - |
| 262 | return; | 0 |
| 263 | } | - |
| 264 | } executed: }Execution Count:6657 | 6657 |
| 265 | } executed: }Execution Count:10705 | 10705 |
| 266 | QPixmapIconEngineEntry e(abs, size, mode, state); | - |
| 267 | e.pixmap = pixmap; | - |
| 268 | pixmaps += e; | - |
| 269 | } executed: }Execution Count:6980 | 6980 |
| 270 | } executed: }Execution Count:6980 | 6980 |
| 271 | | - |
| 272 | QString QPixmapIconEngine::key() const | - |
| 273 | { | - |
| 274 | return QLatin1String("QPixmapIconEngine"); executed: return QLatin1String("QPixmapIconEngine");Execution Count:10 | 10 |
| 275 | } | - |
| 276 | | - |
| 277 | QIconEngine *QPixmapIconEngine::clone() const | - |
| 278 | { | - |
| 279 | return new QPixmapIconEngine(*this); executed: return new QPixmapIconEngine(*this);Execution Count:5 | 5 |
| 280 | } | - |
| 281 | | - |
| 282 | bool QPixmapIconEngine::read(QDataStream &in) | - |
| 283 | { | - |
| 284 | int num_entries; | - |
| 285 | QPixmap pm; | - |
| 286 | QString fileName; | - |
| 287 | QSize sz; | - |
| 288 | uint mode; | - |
| 289 | uint state; | - |
| 290 | | - |
| 291 | in >> num_entries; | - |
| 292 | for (int i=0; i < num_entries; ++i) { evaluated: i < num_entries| yes Evaluation Count:16 | yes Evaluation Count:10 |
| 10-16 |
| 293 | if (in.atEnd()) { partially evaluated: in.atEnd()| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 294 | pixmaps.clear(); | - |
| 295 | return false; never executed: return false; | 0 |
| 296 | } | - |
| 297 | in >> pm; | - |
| 298 | in >> fileName; | - |
| 299 | in >> sz; | - |
| 300 | in >> mode; | - |
| 301 | in >> state; | - |
| 302 | if (pm.isNull()) { partially evaluated: pm.isNull()| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 303 | addFile(fileName, sz, QIcon::Mode(mode), QIcon::State(state)); | - |
| 304 | } else { | 0 |
| 305 | QPixmapIconEngineEntry pe(fileName, sz, QIcon::Mode(mode), QIcon::State(state)); | - |
| 306 | pe.pixmap = pm; | - |
| 307 | pixmaps += pe; | - |
| 308 | } executed: }Execution Count:16 | 16 |
| 309 | } | - |
| 310 | return true; executed: return true;Execution Count:10 | 10 |
| 311 | } | - |
| 312 | | - |
| 313 | bool QPixmapIconEngine::write(QDataStream &out) const | - |
| 314 | { | - |
| 315 | int num_entries = pixmaps.size(); | - |
| 316 | out << num_entries; | - |
| 317 | for (int i=0; i < num_entries; ++i) { evaluated: i < num_entries| yes Evaluation Count:16 | yes Evaluation Count:10 |
| 10-16 |
| 318 | if (pixmaps.at(i).pixmap.isNull()) evaluated: pixmaps.at(i).pixmap.isNull()| yes Evaluation Count:10 | yes Evaluation Count:6 |
| 6-10 |
| 319 | out << QPixmap(pixmaps.at(i).fileName); executed: out << QPixmap(pixmaps.at(i).fileName);Execution Count:10 | 10 |
| 320 | else | - |
| 321 | out << pixmaps.at(i).pixmap; executed: out << pixmaps.at(i).pixmap;Execution Count:6 | 6 |
| 322 | out << pixmaps.at(i).fileName; | - |
| 323 | out << pixmaps.at(i).size; | - |
| 324 | out << (uint) pixmaps.at(i).mode; | - |
| 325 | out << (uint) pixmaps.at(i).state; | - |
| 326 | } executed: }Execution Count:16 | 16 |
| 327 | return true; executed: return true;Execution Count:10 | 10 |
| 328 | } | - |
| 329 | | - |
| 330 | void QPixmapIconEngine::virtual_hook(int id, void *data) | - |
| 331 | { | - |
| 332 | switch (id) { | - |
| 333 | case QIconEngine::AvailableSizesHook: { | - |
| 334 | QIconEngine::AvailableSizesArgument &arg = | - |
| 335 | *reinterpret_cast<QIconEngine::AvailableSizesArgument*>(data); | - |
| 336 | arg.sizes.clear(); | - |
| 337 | for (int i = 0; i < pixmaps.size(); ++i) { evaluated: i < pixmaps.size()| yes Evaluation Count:40 | yes Evaluation Count:16 |
| 16-40 |
| 338 | QPixmapIconEngineEntry &pe = pixmaps[i]; | - |
| 339 | if (pe.size == QSize() && pe.pixmap.isNull()) { evaluated: pe.size == QSize()| yes Evaluation Count:2 | yes Evaluation Count:38 |
partially evaluated: pe.pixmap.isNull()| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-38 |
| 340 | pe.pixmap = QPixmap(pe.fileName); | - |
| 341 | pe.size = pe.pixmap.size(); | - |
| 342 | } executed: }Execution Count:2 | 2 |
| 343 | if (pe.mode == arg.mode && pe.state == arg.state && !pe.size.isEmpty()) evaluated: pe.mode == arg.mode| yes Evaluation Count:34 | yes Evaluation Count:6 |
evaluated: pe.state == arg.state| yes Evaluation Count:30 | yes Evaluation Count:4 |
evaluated: !pe.size.isEmpty()| yes Evaluation Count:29 | yes Evaluation Count:1 |
| 1-34 |
| 344 | arg.sizes.push_back(pe.size); executed: arg.sizes.push_back(pe.size);Execution Count:29 | 29 |
| 345 | } executed: }Execution Count:40 | 40 |
| 346 | break; executed: break;Execution Count:16 | 16 |
| 347 | } | - |
| 348 | default: | - |
| 349 | QIconEngine::virtual_hook(id, data); | - |
| 350 | } executed: }Execution Count:1 | 1 |
| 351 | } executed: }Execution Count:17 | 17 |
| 352 | | - |
| 353 | | - |
| 354 | static QFactoryLoader *loader() { static QGlobalStatic<QFactoryLoader > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QFactoryLoader *x = new QFactoryLoader ("org.qt-project.Qt.QIconEngineFactoryInterface", QLatin1String("/iconengines"), Qt::CaseInsensitive); if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QFactoryLoader > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); } partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)| no Evaluation Count:0 | yes Evaluation Count:15 |
evaluated: !thisGlobalStatic.pointer.load()| yes Evaluation Count:15 | yes Evaluation Count:2075 |
partially evaluated: !thisGlobalStatic.destroyed| yes Evaluation Count:15 | no Evaluation Count:0 |
never executed: delete x; executed: return thisGlobalStatic.pointer.load();Execution Count:2090 | 0-2090 |
| 355 | QIcon::QIcon() | - |
| 356 | : d(0) | - |
| 357 | { | - |
| 358 | } executed: }Execution Count:510312 | 510312 |
| 359 | | - |
| 360 | | - |
| 361 | | - |
| 362 | | - |
| 363 | QIcon::QIcon(const QPixmap &pixmap) | - |
| 364 | :d(0) | - |
| 365 | { | - |
| 366 | addPixmap(pixmap); | - |
| 367 | } executed: }Execution Count:26939 | 26939 |
| 368 | | - |
| 369 | | - |
| 370 | | - |
| 371 | | - |
| 372 | QIcon::QIcon(const QIcon &other) | - |
| 373 | :d(other.d) | - |
| 374 | { | - |
| 375 | if (d) evaluated: d| yes Evaluation Count:148121 | yes Evaluation Count:8583 |
| 8583-148121 |
| 376 | d->ref.ref(); executed: d->ref.ref();Execution Count:148121 | 148121 |
| 377 | } executed: }Execution Count:156704 | 156704 |
| 378 | QIcon::QIcon(const QString &fileName) | - |
| 379 | : d(0) | - |
| 380 | { | - |
| 381 | addFile(fileName); | - |
| 382 | } executed: }Execution Count:323 | 323 |
| 383 | | - |
| 384 | | - |
| 385 | | - |
| 386 | | - |
| 387 | | - |
| 388 | | - |
| 389 | QIcon::QIcon(QIconEngine *engine) | - |
| 390 | :d(new QIconPrivate) | - |
| 391 | { | - |
| 392 | d->engine = engine; | - |
| 393 | } executed: }Execution Count:5 | 5 |
| 394 | | - |
| 395 | | - |
| 396 | | - |
| 397 | | - |
| 398 | QIcon::~QIcon() | - |
| 399 | { | - |
| 400 | if (d && !d->ref.deref()) evaluated: d| yes Evaluation Count:194693 | yes Evaluation Count:499032 |
evaluated: !d->ref.deref()| yes Evaluation Count:4413 | yes Evaluation Count:190280 |
| 4413-499032 |
| 401 | delete d; executed: delete d;Execution Count:4413 | 4413 |
| 402 | } executed: }Execution Count:693725 | 693725 |
| 403 | | - |
| 404 | | - |
| 405 | | - |
| 406 | | - |
| 407 | | - |
| 408 | QIcon &QIcon::operator=(const QIcon &other) | - |
| 409 | { | - |
| 410 | if (other.d) evaluated: other.d| yes Evaluation Count:42658 | yes Evaluation Count:235039 |
| 42658-235039 |
| 411 | other.d->ref.ref(); executed: other.d->ref.ref();Execution Count:42658 | 42658 |
| 412 | if (d && !d->ref.deref()) evaluated: d| yes Evaluation Count:613 | yes Evaluation Count:277084 |
evaluated: !d->ref.deref()| yes Evaluation Count:119 | yes Evaluation Count:494 |
| 119-277084 |
| 413 | delete d; executed: delete d;Execution Count:119 | 119 |
| 414 | d = other.d; | - |
| 415 | return *this; executed: return *this;Execution Count:277697 | 277697 |
| 416 | } | - |
| 417 | QIcon::operator QVariant() const | - |
| 418 | { | - |
| 419 | return QVariant(QVariant::Icon, this); executed: return QVariant(QVariant::Icon, this);Execution Count:31909 | 31909 |
| 420 | } | - |
| 421 | qint64 QIcon::cacheKey() const | - |
| 422 | { | - |
| 423 | if (!d) partially evaluated: !d| no Evaluation Count:0 | yes Evaluation Count:1296 |
| 0-1296 |
| 424 | return 0; never executed: return 0; | 0 |
| 425 | return (((qint64) d->serialNum) << 32) | ((qint64) (d->detach_no)); executed: return (((qint64) d->serialNum) << 32) | ((qint64) (d->detach_no));Execution Count:1296 | 1296 |
| 426 | } | - |
| 427 | QPixmap QIcon::pixmap(const QSize &size, Mode mode, State state) const | - |
| 428 | { | - |
| 429 | if (!d) evaluated: !d| yes Evaluation Count:47 | yes Evaluation Count:1620 |
| 47-1620 |
| 430 | return QPixmap(); executed: return QPixmap();Execution Count:47 | 47 |
| 431 | return d->engine->pixmap(size, mode, state); executed: return d->engine->pixmap(size, mode, state);Execution Count:1620 | 1620 |
| 432 | } | - |
| 433 | QSize QIcon::actualSize(const QSize &size, Mode mode, State state) const | - |
| 434 | { | - |
| 435 | if (!d) evaluated: !d| yes Evaluation Count:2 | yes Evaluation Count:37398 |
| 2-37398 |
| 436 | return QSize(); executed: return QSize();Execution Count:2 | 2 |
| 437 | return d->engine->actualSize(size, mode, state); executed: return d->engine->actualSize(size, mode, state);Execution Count:37398 | 37398 |
| 438 | } | - |
| 439 | void QIcon::paint(QPainter *painter, const QRect &rect, Qt::Alignment alignment, Mode mode, State state) const | - |
| 440 | { | - |
| 441 | if (!d || !painter) evaluated: !d| yes Evaluation Count:10914 | yes Evaluation Count:2587 |
partially evaluated: !painter| no Evaluation Count:0 | yes Evaluation Count:2587 |
| 0-10914 |
| 442 | return; executed: return;Execution Count:10914 | 10914 |
| 443 | | - |
| 444 | | - |
| 445 | const QSize size = d->engine->actualSize(rect.size(), mode, state); | - |
| 446 | alignment = QGuiApplicationPrivate::visualAlignment(painter->layoutDirection(), alignment); | - |
| 447 | int x = rect.x(); | - |
| 448 | int y = rect.y(); | - |
| 449 | int w = size.width(); | - |
| 450 | int h = size.height(); | - |
| 451 | if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter) partially evaluated: (alignment & Qt::AlignVCenter) == Qt::AlignVCenter| yes Evaluation Count:2587 | no Evaluation Count:0 |
| 0-2587 |
| 452 | y += rect.size().height()/2 - h/2; executed: y += rect.size().height()/2 - h/2;Execution Count:2587 | 2587 |
| 453 | else if ((alignment & Qt::AlignBottom) == Qt::AlignBottom) never evaluated: (alignment & Qt::AlignBottom) == Qt::AlignBottom | 0 |
| 454 | y += rect.size().height() - h; never executed: y += rect.size().height() - h; | 0 |
| 455 | if ((alignment & Qt::AlignRight) == Qt::AlignRight) partially evaluated: (alignment & Qt::AlignRight) == Qt::AlignRight| no Evaluation Count:0 | yes Evaluation Count:2587 |
| 0-2587 |
| 456 | x += rect.size().width() - w; never executed: x += rect.size().width() - w; | 0 |
| 457 | else if ((alignment & Qt::AlignHCenter) == Qt::AlignHCenter) partially evaluated: (alignment & Qt::AlignHCenter) == Qt::AlignHCenter| yes Evaluation Count:2587 | no Evaluation Count:0 |
| 0-2587 |
| 458 | x += rect.size().width()/2 - w/2; executed: x += rect.size().width()/2 - w/2;Execution Count:2587 | 2587 |
| 459 | QRect alignedRect(x, y, w, h); | - |
| 460 | | - |
| 461 | d->engine->paint(painter, alignedRect, mode, state); | - |
| 462 | } executed: }Execution Count:2587 | 2587 |
| 463 | bool QIcon::isNull() const | - |
| 464 | { | - |
| 465 | return !d; executed: return !d;Execution Count:279532 | 279532 |
| 466 | } | - |
| 467 | | - |
| 468 | | - |
| 469 | | - |
| 470 | bool QIcon::isDetached() const | - |
| 471 | { | - |
| 472 | return !d || d->ref.load() == 1; never executed: return !d || d->ref.load() == 1; | 0 |
| 473 | } | - |
| 474 | | - |
| 475 | | - |
| 476 | | - |
| 477 | void QIcon::detach() | - |
| 478 | { | - |
| 479 | if (d) { partially evaluated: d| yes Evaluation Count:4954 | no Evaluation Count:0 |
| 0-4954 |
| 480 | if (d->ref.load() != 1) { evaluated: d->ref.load() != 1| yes Evaluation Count:5 | yes Evaluation Count:4949 |
| 5-4949 |
| 481 | QIconPrivate *x = new QIconPrivate; | - |
| 482 | x->engine = d->engine->clone(); | - |
| 483 | if (!d->ref.deref()) partially evaluated: !d->ref.deref()| no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
| 484 | delete d; never executed: delete d; | 0 |
| 485 | d = x; | - |
| 486 | } executed: }Execution Count:5 | 5 |
| 487 | ++d->detach_no; | - |
| 488 | } executed: }Execution Count:4954 | 4954 |
| 489 | } executed: }Execution Count:4954 | 4954 |
| 490 | void QIcon::addPixmap(const QPixmap &pixmap, Mode mode, State state) | - |
| 491 | { | - |
| 492 | if (pixmap.isNull()) evaluated: pixmap.isNull()| yes Evaluation Count:26722 | yes Evaluation Count:2494 |
| 2494-26722 |
| 493 | return; executed: return;Execution Count:26722 | 26722 |
| 494 | if (!d) { evaluated: !d| yes Evaluation Count:2430 | yes Evaluation Count:64 |
| 64-2430 |
| 495 | d = new QIconPrivate; | - |
| 496 | d->engine = new QPixmapIconEngine; | - |
| 497 | } else { executed: }Execution Count:2430 | 2430 |
| 498 | detach(); | - |
| 499 | } executed: }Execution Count:64 | 64 |
| 500 | d->engine->addPixmap(pixmap, mode, state); | - |
| 501 | } executed: }Execution Count:2494 | 2494 |
| 502 | void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State state) | - |
| 503 | { | - |
| 504 | if (fileName.isEmpty()) evaluated: fileName.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:6980 |
| 2-6980 |
| 505 | return; executed: return;Execution Count:2 | 2 |
| 506 | if (!d) { evaluated: !d| yes Evaluation Count:2091 | yes Evaluation Count:4889 |
| 2091-4889 |
| 507 | | - |
| 508 | QFileInfo info(fileName); | - |
| 509 | QString suffix = info.suffix(); | - |
| 510 | if (!suffix.isEmpty()) { evaluated: !suffix.isEmpty()| yes Evaluation Count:2090 | yes Evaluation Count:1 |
| 1-2090 |
| 511 | | - |
| 512 | const int index = loader()->indexOf(suffix); | - |
| 513 | if (index != -1) { partially evaluated: index != -1| no Evaluation Count:0 | yes Evaluation Count:2090 |
| 0-2090 |
| 514 | if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) { never evaluated: QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index)) | 0 |
| 515 | if (QIconEngine *engine = factory->create(fileName)) { never evaluated: QIconEngine *engine = factory->create(fileName) | 0 |
| 516 | d = new QIconPrivate; | - |
| 517 | d->engine = engine; | - |
| 518 | } | 0 |
| 519 | } | 0 |
| 520 | } | 0 |
| 521 | } executed: }Execution Count:2090 | 2090 |
| 522 | | - |
| 523 | | - |
| 524 | if (!d) { partially evaluated: !d| yes Evaluation Count:2091 | no Evaluation Count:0 |
| 0-2091 |
| 525 | d = new QIconPrivate; | - |
| 526 | d->engine = new QPixmapIconEngine; | - |
| 527 | } executed: }Execution Count:2091 | 2091 |
| 528 | } else { executed: }Execution Count:2091 | 2091 |
| 529 | detach(); | - |
| 530 | } executed: }Execution Count:4889 | 4889 |
| 531 | d->engine->addFile(fileName, size, mode, state); | - |
| 532 | } executed: }Execution Count:6980 | 6980 |
| 533 | | - |
| 534 | | - |
| 535 | | - |
| 536 | | - |
| 537 | | - |
| 538 | | - |
| 539 | | - |
| 540 | QList<QSize> QIcon::availableSizes(Mode mode, State state) const | - |
| 541 | { | - |
| 542 | if (!d || !d->engine) evaluated: !d| yes Evaluation Count:1 | yes Evaluation Count:33 |
partially evaluated: !d->engine| no Evaluation Count:0 | yes Evaluation Count:33 |
| 0-33 |
| 543 | return QList<QSize>(); executed: return QList<QSize>();Execution Count:1 | 1 |
| 544 | return d->engine->availableSizes(mode, state); executed: return d->engine->availableSizes(mode, state);Execution Count:33 | 33 |
| 545 | } | - |
| 546 | QString QIcon::name() const | - |
| 547 | { | - |
| 548 | if (!d || !d->engine) evaluated: !d| yes Evaluation Count:1 | yes Evaluation Count:2 |
partially evaluated: !d->engine| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 549 | return QString(); executed: return QString();Execution Count:1 | 1 |
| 550 | return d->engine->iconName(); executed: return d->engine->iconName();Execution Count:2 | 2 |
| 551 | } | - |
| 552 | | - |
| 553 | | - |
| 554 | | - |
| 555 | | - |
| 556 | | - |
| 557 | | - |
| 558 | | - |
| 559 | void QIcon::setThemeSearchPaths(const QStringList &paths) | - |
| 560 | { | - |
| 561 | QIconLoader::instance()->setThemeSearchPath(paths); | - |
| 562 | } executed: }Execution Count:2 | 2 |
| 563 | QStringList QIcon::themeSearchPaths() | - |
| 564 | { | - |
| 565 | return QIconLoader::instance()->themeSearchPaths(); executed: return QIconLoader::instance()->themeSearchPaths();Execution Count:23 | 23 |
| 566 | } | - |
| 567 | void QIcon::setThemeName(const QString &name) | - |
| 568 | { | - |
| 569 | QIconLoader::instance()->setThemeName(name); | - |
| 570 | } executed: }Execution Count:3 | 3 |
| 571 | QString QIcon::themeName() | - |
| 572 | { | - |
| 573 | return QIconLoader::instance()->themeName(); executed: return QIconLoader::instance()->themeName();Execution Count:6856 | 6856 |
| 574 | } | - |
| 575 | QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback) | - |
| 576 | { | - |
| 577 | QIcon icon; | - |
| 578 | | - |
| 579 | if (qtIconCache()->contains(name)) { evaluated: qtIconCache()->contains(name)| yes Evaluation Count:5 | yes Evaluation Count:5 |
| 5 |
| 580 | icon = *qtIconCache()->object(name); | - |
| 581 | } else { executed: }Execution Count:5 | 5 |
| 582 | QIcon *cachedIcon = new QIcon(new QIconLoaderEngine(name)); | - |
| 583 | qtIconCache()->insert(name, cachedIcon); | - |
| 584 | icon = *cachedIcon; | - |
| 585 | } executed: }Execution Count:5 | 5 |
| 586 | | - |
| 587 | | - |
| 588 | | - |
| 589 | if ((static_cast<QGuiApplication *>(QCoreApplication::instance())) && icon.availableSizes().isEmpty()) evaluated: (static_cast<QGuiApplication *>(QCoreApplication::instance()))| yes Evaluation Count:9 | yes Evaluation Count:1 |
evaluated: icon.availableSizes().isEmpty()| yes Evaluation Count:5 | yes Evaluation Count:4 |
| 1-9 |
| 590 | return fallback; executed: return fallback;Execution Count:5 | 5 |
| 591 | | - |
| 592 | return icon; executed: return icon;Execution Count:5 | 5 |
| 593 | } | - |
| 594 | bool QIcon::hasThemeIcon(const QString &name) | - |
| 595 | { | - |
| 596 | QIcon icon = fromTheme(name); | - |
| 597 | | - |
| 598 | return !icon.isNull(); executed: return !icon.isNull();Execution Count:2 | 2 |
| 599 | } | - |
| 600 | QDataStream &operator<<(QDataStream &s, const QIcon &icon) | - |
| 601 | { | - |
| 602 | if (s.version() >= QDataStream::Qt_4_3) { partially evaluated: s.version() >= QDataStream::Qt_4_3| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 603 | if (icon.isNull()) { partially evaluated: icon.isNull()| no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
| 604 | s << QString(); | - |
| 605 | } else { | 0 |
| 606 | s << icon.d->engine->key(); | - |
| 607 | icon.d->engine->write(s); | - |
| 608 | } executed: }Execution Count:11 | 11 |
| 609 | } else if (s.version() == QDataStream::Qt_4_2) { never evaluated: s.version() == QDataStream::Qt_4_2 | 0 |
| 610 | if (icon.isNull()) { never evaluated: icon.isNull() | 0 |
| 611 | s << 0; | - |
| 612 | } else { | 0 |
| 613 | QPixmapIconEngine *engine = static_cast<QPixmapIconEngine *>(icon.d->engine); | - |
| 614 | int num_entries = engine->pixmaps.size(); | - |
| 615 | s << num_entries; | - |
| 616 | for (int i=0; i < num_entries; ++i) { never evaluated: i < num_entries | 0 |
| 617 | s << engine->pixmaps.at(i).pixmap; | - |
| 618 | s << engine->pixmaps.at(i).fileName; | - |
| 619 | s << engine->pixmaps.at(i).size; | - |
| 620 | s << (uint) engine->pixmaps.at(i).mode; | - |
| 621 | s << (uint) engine->pixmaps.at(i).state; | - |
| 622 | } | 0 |
| 623 | } | 0 |
| 624 | } else { | - |
| 625 | s << QPixmap(icon.pixmap(22,22)); | - |
| 626 | } | 0 |
| 627 | return s; executed: return s;Execution Count:11 | 11 |
| 628 | } | - |
| 629 | QDataStream &operator>>(QDataStream &s, QIcon &icon) | - |
| 630 | { | - |
| 631 | if (s.version() >= QDataStream::Qt_4_3) { partially evaluated: s.version() >= QDataStream::Qt_4_3| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 632 | icon = QIcon(); | - |
| 633 | QString key; | - |
| 634 | s >> key; | - |
| 635 | if (key == QLatin1String("QPixmapIconEngine")) { evaluated: key == QLatin1String("QPixmapIconEngine")| yes Evaluation Count:10 | yes Evaluation Count:1 |
| 1-10 |
| 636 | icon.d = new QIconPrivate; | - |
| 637 | QIconEngine *engine = new QPixmapIconEngine; | - |
| 638 | icon.d->engine = engine; | - |
| 639 | engine->read(s); | - |
| 640 | } else if (key == QLatin1String("QIconLoaderEngine")) { executed: }Execution Count:10 partially evaluated: key == QLatin1String("QIconLoaderEngine")| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-10 |
| 641 | icon.d = new QIconPrivate; | - |
| 642 | QIconEngine *engine = new QIconLoaderEngine(); | - |
| 643 | icon.d->engine = engine; | - |
| 644 | engine->read(s); | - |
| 645 | | - |
| 646 | } else { executed: }Execution Count:1 | 1 |
| 647 | const int index = loader()->indexOf(key); | - |
| 648 | if (index != -1) { never evaluated: index != -1 | 0 |
| 649 | if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) { never evaluated: QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index)) | 0 |
| 650 | if (QIconEngine *engine= factory->create()) { never evaluated: QIconEngine *engine= factory->create() | 0 |
| 651 | icon.d = new QIconPrivate; | - |
| 652 | icon.d->engine = engine; | - |
| 653 | engine->read(s); | - |
| 654 | } | 0 |
| 655 | } | 0 |
| 656 | } | 0 |
| 657 | | - |
| 658 | } | 0 |
| 659 | } else if (s.version() == QDataStream::Qt_4_2) { never evaluated: s.version() == QDataStream::Qt_4_2 | 0 |
| 660 | icon = QIcon(); | - |
| 661 | int num_entries; | - |
| 662 | QPixmap pm; | - |
| 663 | QString fileName; | - |
| 664 | QSize sz; | - |
| 665 | uint mode; | - |
| 666 | uint state; | - |
| 667 | | - |
| 668 | s >> num_entries; | - |
| 669 | for (int i=0; i < num_entries; ++i) { never evaluated: i < num_entries | 0 |
| 670 | s >> pm; | - |
| 671 | s >> fileName; | - |
| 672 | s >> sz; | - |
| 673 | s >> mode; | - |
| 674 | s >> state; | - |
| 675 | if (pm.isNull()) never evaluated: pm.isNull() | 0 |
| 676 | icon.addFile(fileName, sz, QIcon::Mode(mode), QIcon::State(state)); never executed: icon.addFile(fileName, sz, QIcon::Mode(mode), QIcon::State(state)); | 0 |
| 677 | else | - |
| 678 | icon.addPixmap(pm, QIcon::Mode(mode), QIcon::State(state)); never executed: icon.addPixmap(pm, QIcon::Mode(mode), QIcon::State(state)); | 0 |
| 679 | } | - |
| 680 | } else { | 0 |
| 681 | QPixmap pm; | - |
| 682 | s >> pm; | - |
| 683 | icon.addPixmap(pm); | - |
| 684 | } | 0 |
| 685 | return s; executed: return s;Execution Count:11 | 11 |
| 686 | } | - |
| 687 | | - |
| 688 | | - |
| 689 | | - |
| 690 | | - |
| 691 | QDebug operator<<(QDebug dbg, const QIcon &i) | - |
| 692 | { | - |
| 693 | dbg.nospace() << "QIcon(" << i.name() << ')'; | - |
| 694 | return dbg.space(); executed: return dbg.space();Execution Count:1 | 1 |
| 695 | } | - |
| 696 | | - |
| 697 | | - |
| | |