| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | static int qt_palette_count = 1; | - |
| 5 | | - |
| 6 | class QPalettePrivate { | - |
| 7 | public: | - |
| 8 | QPalettePrivate() : ref(1), ser_no(qt_palette_count++), detach_no(0) { } executed: }Execution Count:69666 | 69666 |
| 9 | QAtomicInt ref; | - |
| 10 | QBrush br[QPalette::NColorGroups][QPalette::NColorRoles]; | - |
| 11 | int ser_no; | - |
| 12 | int detach_no; | - |
| 13 | }; | - |
| 14 | | - |
| 15 | static QColor qt_mix_colors(QColor a, QColor b) | - |
| 16 | { | - |
| 17 | return QColor((a.red() + b.red()) / 2, (a.green() + b.green()) / 2, | 7980 |
| 18 | (a.blue() + b.blue()) / 2, (a.alpha() + b.alpha()) / 2); executed: return QColor((a.red() + b.red()) / 2, (a.green() + b.green()) / 2, (a.blue() + b.blue()) / 2, (a.alpha() + b.alpha()) / 2);Execution Count:7980 | 7980 |
| 19 | } | - |
| 20 | | - |
| 21 | static void qt_palette_from_color(QPalette &pal, const QColor &button) | - |
| 22 | { | - |
| 23 | int h, s, v; | - |
| 24 | button.getHsv(&h, &s, &v); | - |
| 25 | | - |
| 26 | const QBrush whiteBrush = QBrush(Qt::white); | - |
| 27 | const QBrush blackBrush = QBrush(Qt::black); | - |
| 28 | const QBrush baseBrush = v > 128 ? whiteBrush : blackBrush; evaluated: v > 128| yes Evaluation Count:32 | yes Evaluation Count:1224 |
| 32-1224 |
| 29 | const QBrush foregroundBrush = v > 128 ? blackBrush : whiteBrush; evaluated: v > 128| yes Evaluation Count:32 | yes Evaluation Count:1224 |
| 32-1224 |
| 30 | const QBrush buttonBrush = QBrush(button); | - |
| 31 | const QBrush buttonBrushDark = QBrush(button.darker()); | - |
| 32 | const QBrush buttonBrushDark150 = QBrush(button.darker(150)); | - |
| 33 | const QBrush buttonBrushLight150 = QBrush(button.lighter(150)); | - |
| 34 | pal.setColorGroup(QPalette::Active, foregroundBrush, buttonBrush, buttonBrushLight150, | - |
| 35 | buttonBrushDark, buttonBrushDark150, foregroundBrush, whiteBrush, | - |
| 36 | baseBrush, buttonBrush); | - |
| 37 | pal.setColorGroup(QPalette::Inactive, foregroundBrush, buttonBrush, buttonBrushLight150, | - |
| 38 | buttonBrushDark, buttonBrushDark150, foregroundBrush, whiteBrush, | - |
| 39 | baseBrush, buttonBrush); | - |
| 40 | pal.setColorGroup(QPalette::Disabled, buttonBrushDark, buttonBrush, buttonBrushLight150, | - |
| 41 | buttonBrushDark, buttonBrushDark150, buttonBrushDark, | - |
| 42 | whiteBrush, buttonBrush, buttonBrush); | - |
| 43 | } executed: }Execution Count:1256 | 1256 |
| 44 | QPalette::QPalette() | - |
| 45 | : d(0) | - |
| 46 | { | - |
| 47 | data.current_group = Active; | - |
| 48 | data.resolve_mask = 0; | - |
| 49 | | - |
| 50 | | - |
| 51 | | - |
| 52 | if (QGuiApplicationPrivate::app_pal) { evaluated: QGuiApplicationPrivate::app_pal| yes Evaluation Count:607947 | yes Evaluation Count:1220 |
| 1220-607947 |
| 53 | d = QGuiApplicationPrivate::app_pal->d; | - |
| 54 | d->ref.ref(); | - |
| 55 | } else { executed: }Execution Count:607947 | 607947 |
| 56 | init(); | - |
| 57 | qt_palette_from_color(*this, Qt::black); | - |
| 58 | data.resolve_mask = 0; | - |
| 59 | } executed: }Execution Count:1220 | 1220 |
| 60 | } | - |
| 61 | | - |
| 62 | | - |
| 63 | | - |
| 64 | | - |
| 65 | | - |
| 66 | | - |
| 67 | QPalette::QPalette(const QColor &button) | - |
| 68 | { | - |
| 69 | init(); | - |
| 70 | qt_palette_from_color(*this, button); | - |
| 71 | } executed: }Execution Count:1 | 1 |
| 72 | | - |
| 73 | | - |
| 74 | | - |
| 75 | | - |
| 76 | | - |
| 77 | | - |
| 78 | QPalette::QPalette(Qt::GlobalColor button) | - |
| 79 | { | - |
| 80 | init(); | - |
| 81 | qt_palette_from_color(*this, button); | - |
| 82 | } executed: }Execution Count:35 | 35 |
| 83 | QPalette::QPalette(const QBrush &windowText, const QBrush &button, | - |
| 84 | const QBrush &light, const QBrush &dark, | - |
| 85 | const QBrush &mid, const QBrush &text, | - |
| 86 | const QBrush &bright_text, const QBrush &base, | - |
| 87 | const QBrush &window) | - |
| 88 | { | - |
| 89 | init(); | - |
| 90 | setColorGroup(All, windowText, button, light, dark, mid, text, bright_text, | - |
| 91 | base, window); | - |
| 92 | } executed: }Execution Count:1 | 1 |
| 93 | QPalette::QPalette(const QColor &windowText, const QColor &window, | - |
| 94 | const QColor &light, const QColor &dark, const QColor &mid, | - |
| 95 | const QColor &text, const QColor &base) | - |
| 96 | { | - |
| 97 | init(); | - |
| 98 | const QBrush windowBrush(window); | - |
| 99 | const QBrush lightBrush(light); | - |
| 100 | setColorGroup(All, QBrush(windowText), windowBrush, lightBrush, | - |
| 101 | QBrush(dark), QBrush(mid), QBrush(text), lightBrush, | - |
| 102 | QBrush(base), windowBrush); | - |
| 103 | } executed: }Execution Count:215 | 215 |
| 104 | | - |
| 105 | | - |
| 106 | | - |
| 107 | | - |
| 108 | | - |
| 109 | | - |
| 110 | QPalette::QPalette(const QColor &button, const QColor &window) | - |
| 111 | { | - |
| 112 | init(); | - |
| 113 | int h, s, v; | - |
| 114 | window.getHsv(&h, &s, &v); | - |
| 115 | | - |
| 116 | const QBrush windowBrush = QBrush(window); | - |
| 117 | const QBrush whiteBrush = QBrush(Qt::white); | - |
| 118 | const QBrush blackBrush = QBrush(Qt::black); | - |
| 119 | const QBrush baseBrush = v > 128 ? whiteBrush : blackBrush; partially evaluated: v > 128| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 120 | const QBrush foregroundBrush = v > 128 ? blackBrush : whiteBrush; partially evaluated: v > 128| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 121 | const QBrush disabledForeground = QBrush(Qt::darkGray); | - |
| 122 | | - |
| 123 | const QBrush buttonBrush = QBrush(button); | - |
| 124 | const QBrush buttonBrushDark = QBrush(button.darker()); | - |
| 125 | const QBrush buttonBrushDark150 = QBrush(button.darker(150)); | - |
| 126 | const QBrush buttonBrushLight150 = QBrush(button.lighter(150)); | - |
| 127 | | - |
| 128 | | - |
| 129 | setColorGroup(Inactive, foregroundBrush, buttonBrush, buttonBrushLight150, buttonBrushDark, | - |
| 130 | buttonBrushDark150, foregroundBrush, whiteBrush, baseBrush, | - |
| 131 | windowBrush); | - |
| 132 | setColorGroup(Active, foregroundBrush, buttonBrush, buttonBrushLight150, buttonBrushDark, | - |
| 133 | buttonBrushDark150, foregroundBrush, whiteBrush, baseBrush, | - |
| 134 | windowBrush); | - |
| 135 | setColorGroup(Disabled, disabledForeground, buttonBrush, buttonBrushLight150, | - |
| 136 | buttonBrushDark, buttonBrushDark150, disabledForeground, | - |
| 137 | whiteBrush, baseBrush, windowBrush); | - |
| 138 | } executed: }Execution Count:2 | 2 |
| 139 | | - |
| 140 | | - |
| 141 | | - |
| 142 | | - |
| 143 | | - |
| 144 | | - |
| 145 | QPalette::QPalette(const QPalette &p) | - |
| 146 | : d(p.d), data(p.data) | - |
| 147 | { | - |
| 148 | d->ref.ref(); | - |
| 149 | } executed: }Execution Count:312418 | 312418 |
| 150 | | - |
| 151 | | - |
| 152 | | - |
| 153 | | - |
| 154 | QPalette::~QPalette() | - |
| 155 | { | - |
| 156 | if(!d->ref.deref()) evaluated: !d->ref.deref()| yes Evaluation Count:69394 | yes Evaluation Count:847748 |
| 69394-847748 |
| 157 | delete d; executed: delete d;Execution Count:69394 | 69394 |
| 158 | } executed: }Execution Count:917142 | 917142 |
| 159 | | - |
| 160 | | - |
| 161 | void QPalette::init() { | - |
| 162 | d = new QPalettePrivate; | - |
| 163 | data.resolve_mask = 0; | - |
| 164 | data.current_group = Active; | - |
| 165 | } executed: }Execution Count:1474 | 1474 |
| 166 | | - |
| 167 | | - |
| 168 | | - |
| 169 | | - |
| 170 | | - |
| 171 | | - |
| 172 | | - |
| 173 | QPalette &QPalette::operator=(const QPalette &p) | - |
| 174 | { | - |
| 175 | p.d->ref.ref(); | - |
| 176 | data = p.data; | - |
| 177 | if(!d->ref.deref()) evaluated: !d->ref.deref()| yes Evaluation Count:242 | yes Evaluation Count:614476 |
| 242-614476 |
| 178 | delete d; executed: delete d;Execution Count:242 | 242 |
| 179 | d = p.d; | - |
| 180 | return *this; executed: return *this;Execution Count:614718 | 614718 |
| 181 | } | - |
| 182 | QPalette::operator QVariant() const | - |
| 183 | { | - |
| 184 | return QVariant(QVariant::Palette, this); executed: return QVariant(QVariant::Palette, this);Execution Count:2 | 2 |
| 185 | } | - |
| 186 | const QBrush &QPalette::brush(ColorGroup gr, ColorRole cr) const | - |
| 187 | { | - |
| 188 | qt_noop(); | - |
| 189 | if(gr >= (int)NColorGroups) { evaluated: gr >= (int)NColorGroups| yes Evaluation Count:227707 | yes Evaluation Count:52398 |
| 52398-227707 |
| 190 | if(gr == Current) { partially evaluated: gr == Current| yes Evaluation Count:227707 | no Evaluation Count:0 |
| 0-227707 |
| 191 | gr = (ColorGroup)data.current_group; | - |
| 192 | } else { executed: }Execution Count:227707 | 227707 |
| 193 | QMessageLogger("kernel/qpalette.cpp", 709, __PRETTY_FUNCTION__).warning("QPalette::brush: Unknown ColorGroup: %d", (int)gr); | - |
| 194 | gr = Active; | - |
| 195 | } | 0 |
| 196 | } | - |
| 197 | return d->br[gr][cr]; executed: return d->br[gr][cr];Execution Count:280105 | 280105 |
| 198 | } | - |
| 199 | void QPalette::setBrush(ColorGroup cg, ColorRole cr, const QBrush &b) | - |
| 200 | { | - |
| 201 | qt_noop(); | - |
| 202 | detach(); | - |
| 203 | if(cg >= (int)NColorGroups) { evaluated: cg >= (int)NColorGroups| yes Evaluation Count:81088 | yes Evaluation Count:76969 |
| 76969-81088 |
| 204 | if(cg == All) { partially evaluated: cg == All| yes Evaluation Count:81088 | no Evaluation Count:0 |
| 0-81088 |
| 205 | for(int i = 0; i < (int)NColorGroups; i++) evaluated: i < (int)NColorGroups| yes Evaluation Count:243264 | yes Evaluation Count:81088 |
| 81088-243264 |
| 206 | d->br[i][cr] = b; executed: d->br[i][cr] = b;Execution Count:243264 | 243264 |
| 207 | data.resolve_mask |= (1<<cr); | - |
| 208 | return; executed: return;Execution Count:81088 | 81088 |
| 209 | } else if(cg == Current) { never evaluated: cg == Current | 0 |
| 210 | cg = (ColorGroup)data.current_group; | - |
| 211 | } else { | 0 |
| 212 | QMessageLogger("kernel/qpalette.cpp", 747, __PRETTY_FUNCTION__).warning("QPalette::setBrush: Unknown ColorGroup: %d", (int)cg); | - |
| 213 | cg = Active; | - |
| 214 | } | 0 |
| 215 | } | - |
| 216 | d->br[cg][cr] = b; | - |
| 217 | data.resolve_mask |= (1<<cr); | - |
| 218 | } executed: }Execution Count:76969 | 76969 |
| 219 | bool QPalette::isBrushSet(ColorGroup cg, ColorRole cr) const | - |
| 220 | { | - |
| 221 | (void)cg;; | - |
| 222 | return (data.resolve_mask & (1<<cr)); executed: return (data.resolve_mask & (1<<cr));Execution Count:1009 | 1009 |
| 223 | } | - |
| 224 | | - |
| 225 | | - |
| 226 | | - |
| 227 | | - |
| 228 | void QPalette::detach() | - |
| 229 | { | - |
| 230 | if (d->ref.load() != 1) { evaluated: d->ref.load() != 1| yes Evaluation Count:68192 | yes Evaluation Count:94099 |
| 68192-94099 |
| 231 | QPalettePrivate *x = new QPalettePrivate; | - |
| 232 | for(int grp = 0; grp < (int)NColorGroups; grp++) { evaluated: grp < (int)NColorGroups| yes Evaluation Count:204576 | yes Evaluation Count:68192 |
| 68192-204576 |
| 233 | for(int role = 0; role < (int)NColorRoles; role++) evaluated: role < (int)NColorRoles| yes Evaluation Count:4091520 | yes Evaluation Count:204576 |
| 204576-4091520 |
| 234 | x->br[grp][role] = d->br[grp][role]; executed: x->br[grp][role] = d->br[grp][role];Execution Count:4091520 | 4091520 |
| 235 | } executed: }Execution Count:204576 | 204576 |
| 236 | if(!d->ref.deref()) partially evaluated: !d->ref.deref()| no Evaluation Count:0 | yes Evaluation Count:68192 |
| 0-68192 |
| 237 | delete d; never executed: delete d; | 0 |
| 238 | d = x; | - |
| 239 | } executed: }Execution Count:68192 | 68192 |
| 240 | ++d->detach_no; | - |
| 241 | } executed: }Execution Count:162291 | 162291 |
| 242 | bool QPalette::operator==(const QPalette &p) const | - |
| 243 | { | - |
| 244 | if (isCopyOf(p)) evaluated: isCopyOf(p)| yes Evaluation Count:96308 | yes Evaluation Count:804 |
| 804-96308 |
| 245 | return true; executed: return true;Execution Count:96308 | 96308 |
| 246 | for(int grp = 0; grp < (int)NColorGroups; grp++) { evaluated: grp < (int)NColorGroups| yes Evaluation Count:1146 | yes Evaluation Count:171 |
| 171-1146 |
| 247 | for(int role = 0; role < (int)NColorRoles; role++) { evaluated: role < (int)NColorRoles| yes Evaluation Count:15847 | yes Evaluation Count:513 |
| 513-15847 |
| 248 | if(d->br[grp][role] != p.d->br[grp][role]) evaluated: d->br[grp][role] != p.d->br[grp][role]| yes Evaluation Count:633 | yes Evaluation Count:15214 |
| 633-15214 |
| 249 | return false; executed: return false;Execution Count:633 | 633 |
| 250 | } executed: }Execution Count:15214 | 15214 |
| 251 | } executed: }Execution Count:513 | 513 |
| 252 | return true; executed: return true;Execution Count:171 | 171 |
| 253 | } | - |
| 254 | | - |
| 255 | | - |
| 256 | | - |
| 257 | | - |
| 258 | | - |
| 259 | | - |
| 260 | | - |
| 261 | bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2) const | - |
| 262 | { | - |
| 263 | if(group1 >= (int)NColorGroups) { partially evaluated: group1 >= (int)NColorGroups| no Evaluation Count:0 | yes Evaluation Count:14207 |
| 0-14207 |
| 264 | if(group1 == Current) { never evaluated: group1 == Current | 0 |
| 265 | group1 = (ColorGroup)data.current_group; | - |
| 266 | } else { | 0 |
| 267 | QMessageLogger("kernel/qpalette.cpp", 833, __PRETTY_FUNCTION__).warning("QPalette::brush: Unknown ColorGroup(1): %d", (int)group1); | - |
| 268 | group1 = Active; | - |
| 269 | } | 0 |
| 270 | } | - |
| 271 | if(group2 >= (int)NColorGroups) { partially evaluated: group2 >= (int)NColorGroups| no Evaluation Count:0 | yes Evaluation Count:14207 |
| 0-14207 |
| 272 | if(group2 == Current) { never evaluated: group2 == Current | 0 |
| 273 | group2 = (ColorGroup)data.current_group; | - |
| 274 | } else { | 0 |
| 275 | QMessageLogger("kernel/qpalette.cpp", 841, __PRETTY_FUNCTION__).warning("QPalette::brush: Unknown ColorGroup(2): %d", (int)group2); | - |
| 276 | group2 = Active; | - |
| 277 | } | 0 |
| 278 | } | - |
| 279 | if(group1 == group2) partially evaluated: group1 == group2| no Evaluation Count:0 | yes Evaluation Count:14207 |
| 0-14207 |
| 280 | return true; never executed: return true; | 0 |
| 281 | for(int role = 0; role < (int)NColorRoles; role++) { evaluated: role < (int)NColorRoles| yes Evaluation Count:284084 | yes Evaluation Count:14199 |
| 14199-284084 |
| 282 | if(d->br[group1][role] != d->br[group2][role]) evaluated: d->br[group1][role] != d->br[group2][role]| yes Evaluation Count:8 | yes Evaluation Count:284076 |
| 8-284076 |
| 283 | return false; executed: return false;Execution Count:8 | 8 |
| 284 | } executed: }Execution Count:284076 | 284076 |
| 285 | return true; executed: return true;Execution Count:14199 | 14199 |
| 286 | } | - |
| 287 | qint64 QPalette::cacheKey() const | - |
| 288 | { | - |
| 289 | return (((qint64) d->ser_no) << 32) | ((qint64) (d->detach_no)); executed: return (((qint64) d->ser_no) << 32) | ((qint64) (d->detach_no));Execution Count:10298 | 10298 |
| 290 | } | - |
| 291 | | - |
| 292 | | - |
| 293 | | - |
| 294 | | - |
| 295 | QPalette QPalette::resolve(const QPalette &other) const | - |
| 296 | { | - |
| 297 | if ((*this == other && data.resolve_mask == other.data.resolve_mask) evaluated: *this == other| yes Evaluation Count:48885 | yes Evaluation Count:345 |
evaluated: data.resolve_mask == other.data.resolve_mask| yes Evaluation Count:48834 | yes Evaluation Count:51 |
| 51-48885 |
| 298 | || data.resolve_mask == 0) { evaluated: data.resolve_mask == 0| yes Evaluation Count:152 | yes Evaluation Count:244 |
| 152-244 |
| 299 | QPalette o = other; | - |
| 300 | o.data.resolve_mask = data.resolve_mask; | - |
| 301 | return o; executed: return o;Execution Count:48986 | 48986 |
| 302 | } | - |
| 303 | | - |
| 304 | QPalette palette(*this); | - |
| 305 | palette.detach(); | - |
| 306 | | - |
| 307 | for(int role = 0; role < (int)NColorRoles; role++) evaluated: role < (int)NColorRoles| yes Evaluation Count:4880 | yes Evaluation Count:244 |
| 244-4880 |
| 308 | if (!(data.resolve_mask & (1<<role))) evaluated: !(data.resolve_mask & (1<<role))| yes Evaluation Count:3984 | yes Evaluation Count:896 |
| 896-3984 |
| 309 | for(int grp = 0; grp < (int)NColorGroups; grp++) evaluated: grp < (int)NColorGroups| yes Evaluation Count:11952 | yes Evaluation Count:3984 |
| 3984-11952 |
| 310 | palette.d->br[grp][role] = other.d->br[grp][role]; executed: palette.d->br[grp][role] = other.d->br[grp][role];Execution Count:11952 | 11952 |
| 311 | | - |
| 312 | return palette; executed: return palette;Execution Count:244 | 244 |
| 313 | } | - |
| 314 | static const int NumOldRoles = 7; | - |
| 315 | static const int oldRoles[7] = { QPalette::Foreground, QPalette::Background, QPalette::Light, | - |
| 316 | QPalette::Dark, QPalette::Mid, QPalette::Text, QPalette::Base }; | - |
| 317 | QDataStream &operator<<(QDataStream &s, const QPalette &p) | - |
| 318 | { | - |
| 319 | for (int grp = 0; grp < (int)QPalette::NColorGroups; grp++) { evaluated: grp < (int)QPalette::NColorGroups| yes Evaluation Count:87 | yes Evaluation Count:29 |
| 29-87 |
| 320 | if (s.version() == 1) { evaluated: s.version() == 1| yes Evaluation Count:6 | yes Evaluation Count:81 |
| 6-81 |
| 321 | | - |
| 322 | for (int i = 0; i < NumOldRoles; ++i) evaluated: i < NumOldRoles| yes Evaluation Count:42 | yes Evaluation Count:6 |
| 6-42 |
| 323 | s << p.d->br[grp][oldRoles[i]].color(); executed: s << p.d->br[grp][oldRoles[i]].color();Execution Count:42 | 42 |
| 324 | } else { executed: }Execution Count:6 | 6 |
| 325 | int max = QPalette::ToolTipText + 1; | - |
| 326 | if (s.version() <= QDataStream::Qt_2_1) evaluated: s.version() <= QDataStream::Qt_2_1| yes Evaluation Count:15 | yes Evaluation Count:66 |
| 15-66 |
| 327 | max = QPalette::HighlightedText + 1; executed: max = QPalette::HighlightedText + 1;Execution Count:15 | 15 |
| 328 | else if (s.version() <= QDataStream::Qt_4_3) evaluated: s.version() <= QDataStream::Qt_4_3| yes Evaluation Count:39 | yes Evaluation Count:27 |
| 27-39 |
| 329 | max = QPalette::AlternateBase + 1; executed: max = QPalette::AlternateBase + 1;Execution Count:39 | 39 |
| 330 | for (int r = 0; r < max; r++) evaluated: r < max| yes Evaluation Count:1413 | yes Evaluation Count:81 |
| 81-1413 |
| 331 | s << p.d->br[grp][r]; executed: s << p.d->br[grp][r];Execution Count:1413 | 1413 |
| 332 | } executed: }Execution Count:81 | 81 |
| 333 | } | - |
| 334 | return s; executed: return s;Execution Count:29 | 29 |
| 335 | } | - |
| 336 | | - |
| 337 | static void readV1ColorGroup(QDataStream &s, QPalette &pal, QPalette::ColorGroup grp) | - |
| 338 | { | - |
| 339 | for (int i = 0; i < NumOldRoles; ++i) { evaluated: i < NumOldRoles| yes Evaluation Count:42 | yes Evaluation Count:6 |
| 6-42 |
| 340 | QColor col; | - |
| 341 | s >> col; | - |
| 342 | pal.setColor(grp, (QPalette::ColorRole)oldRoles[i], col); | - |
| 343 | } executed: }Execution Count:42 | 42 |
| 344 | } executed: }Execution Count:6 | 6 |
| 345 | QDataStream &operator>>(QDataStream &s, QPalette &p) | - |
| 346 | { | - |
| 347 | if(s.version() == 1) { evaluated: s.version() == 1| yes Evaluation Count:2 | yes Evaluation Count:27 |
| 2-27 |
| 348 | p = QPalette(); | - |
| 349 | readV1ColorGroup(s, p, QPalette::Active); | - |
| 350 | readV1ColorGroup(s, p, QPalette::Disabled); | - |
| 351 | readV1ColorGroup(s, p, QPalette::Inactive); | - |
| 352 | } else { executed: }Execution Count:2 | 2 |
| 353 | int max = QPalette::NColorRoles; | - |
| 354 | if (s.version() <= QDataStream::Qt_2_1) { evaluated: s.version() <= QDataStream::Qt_2_1| yes Evaluation Count:5 | yes Evaluation Count:22 |
| 5-22 |
| 355 | p = QPalette(); | - |
| 356 | max = QPalette::HighlightedText + 1; | - |
| 357 | } else if (s.version() <= QDataStream::Qt_4_3) { executed: }Execution Count:5 evaluated: s.version() <= QDataStream::Qt_4_3| yes Evaluation Count:13 | yes Evaluation Count:9 |
| 5-13 |
| 358 | p = QPalette(); | - |
| 359 | max = QPalette::AlternateBase + 1; | - |
| 360 | } executed: }Execution Count:13 | 13 |
| 361 | | - |
| 362 | QBrush tmp; | - |
| 363 | for(int grp = 0; grp < (int)QPalette::NColorGroups; ++grp) { evaluated: grp < (int)QPalette::NColorGroups| yes Evaluation Count:81 | yes Evaluation Count:27 |
| 27-81 |
| 364 | for(int role = 0; role < max; ++role) { evaluated: role < max| yes Evaluation Count:1413 | yes Evaluation Count:81 |
| 81-1413 |
| 365 | s >> tmp; | - |
| 366 | p.setBrush((QPalette::ColorGroup)grp, (QPalette::ColorRole)role, tmp); | - |
| 367 | } executed: }Execution Count:1413 | 1413 |
| 368 | } executed: }Execution Count:81 | 81 |
| 369 | } executed: }Execution Count:27 | 27 |
| 370 | return s; executed: return s;Execution Count:29 | 29 |
| 371 | } | - |
| 372 | bool QPalette::isCopyOf(const QPalette &p) const | - |
| 373 | { | - |
| 374 | return d == p.d; executed: return d == p.d;Execution Count:178485 | 178485 |
| 375 | } | - |
| 376 | void QPalette::setColorGroup(ColorGroup cg, const QBrush &windowText, const QBrush &button, | - |
| 377 | const QBrush &light, const QBrush &dark, const QBrush &mid, | - |
| 378 | const QBrush &text, const QBrush &bright_text, const QBrush &base, | - |
| 379 | const QBrush &window) | - |
| 380 | { | - |
| 381 | QBrush alt_base = QBrush(qt_mix_colors(base.color(), button.color())); | - |
| 382 | QBrush mid_light = QBrush(qt_mix_colors(button.color(), light.color())); | - |
| 383 | QColor toolTipBase(255, 255, 220); | - |
| 384 | QColor toolTipText(0, 0, 0); | - |
| 385 | | - |
| 386 | setColorGroup(cg, windowText, button, light, dark, mid, text, bright_text, base, | - |
| 387 | alt_base, window, mid_light, text, | - |
| 388 | QBrush(Qt::black), QBrush(Qt::darkBlue), QBrush(Qt::white), | - |
| 389 | QBrush(Qt::blue), QBrush(Qt::magenta), QBrush(toolTipBase), | - |
| 390 | QBrush(toolTipText)); | - |
| 391 | | - |
| 392 | data.resolve_mask &= ~(1 << Highlight); | - |
| 393 | data.resolve_mask &= ~(1 << HighlightedText); | - |
| 394 | data.resolve_mask &= ~(1 << LinkVisited); | - |
| 395 | data.resolve_mask &= ~(1 << Link); | - |
| 396 | } executed: }Execution Count:3990 | 3990 |
| 397 | | - |
| 398 | | - |
| 399 | | - |
| 400 | void | - |
| 401 | QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBrush &button, | - |
| 402 | const QBrush &light, const QBrush &dark, const QBrush &mid, | - |
| 403 | const QBrush &text, const QBrush &bright_text, | - |
| 404 | const QBrush &base, const QBrush &alternate_base, | - |
| 405 | const QBrush &background, const QBrush &midlight, | - |
| 406 | const QBrush &button_text, const QBrush &shadow, | - |
| 407 | const QBrush &highlight, const QBrush &highlighted_text, | - |
| 408 | const QBrush &link, const QBrush &link_visited) | - |
| 409 | { | - |
| 410 | setColorGroup(cg, foreground, button, light, dark, mid, | - |
| 411 | text, bright_text, base, alternate_base, background, | - |
| 412 | midlight, button_text, shadow, highlight, highlighted_text, | - |
| 413 | link, link_visited, background, foreground); | - |
| 414 | } | 0 |
| 415 | | - |
| 416 | | - |
| 417 | void QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBrush &button, | - |
| 418 | const QBrush &light, const QBrush &dark, const QBrush &mid, | - |
| 419 | const QBrush &text, const QBrush &bright_text, | - |
| 420 | const QBrush &base, const QBrush &alternate_base, | - |
| 421 | const QBrush &background, const QBrush &midlight, | - |
| 422 | const QBrush &button_text, const QBrush &shadow, | - |
| 423 | const QBrush &highlight, const QBrush &highlighted_text, | - |
| 424 | const QBrush &link, const QBrush &link_visited, | - |
| 425 | const QBrush &toolTipBase, const QBrush &toolTipText) | - |
| 426 | { | - |
| 427 | detach(); | - |
| 428 | setBrush(cg, WindowText, foreground); | - |
| 429 | setBrush(cg, Button, button); | - |
| 430 | setBrush(cg, Light, light); | - |
| 431 | setBrush(cg, Dark, dark); | - |
| 432 | setBrush(cg, Mid, mid); | - |
| 433 | setBrush(cg, Text, text); | - |
| 434 | setBrush(cg, BrightText, bright_text); | - |
| 435 | setBrush(cg, Base, base); | - |
| 436 | setBrush(cg, AlternateBase, alternate_base); | - |
| 437 | setBrush(cg, Window, background); | - |
| 438 | setBrush(cg, Midlight, midlight); | - |
| 439 | setBrush(cg, ButtonText, button_text); | - |
| 440 | setBrush(cg, Shadow, shadow); | - |
| 441 | setBrush(cg, Highlight, highlight); | - |
| 442 | setBrush(cg, HighlightedText, highlighted_text); | - |
| 443 | setBrush(cg, Link, link); | - |
| 444 | setBrush(cg, LinkVisited, link_visited); | - |
| 445 | setBrush(cg, ToolTipBase, toolTipBase); | - |
| 446 | setBrush(cg, ToolTipText, toolTipText); | - |
| 447 | } executed: }Execution Count:3990 | 3990 |
| 448 | | - |
| 449 | | - |
| 450 | QDebug operator<<(QDebug dbg, const QPalette &) | - |
| 451 | { | - |
| 452 | dbg.nospace() << "QPalette()"; | - |
| 453 | return dbg.space(); executed: return dbg.space();Execution Count:1 | 1 |
| 454 | } | - |
| 455 | | - |
| 456 | | - |
| 457 | | - |
| 458 | | - |
| | |