| 43 | } |
| 44 | |
| 45 | uint ExpandingWidgetModel::matchColor(const QModelIndex& index) const |
| 46 | { |
| 47 | int matchQuality = contextMatchQuality(index.sibling(index.row(), 0)); |
| 48 | |
| 49 | if (matchQuality > 0) { |
| 50 | bool alternate = index.row() & 1; |
| 51 | |
| 52 | QColor badMatchColor(0xff00aa44); //Blue-ish green |
| 53 | QColor goodMatchColor(0xff00ff00); //Green |
| 54 | |
| 55 | QColor background = treeView()->palette().light().color(); |
| 56 | |
| 57 | QColor totalColor = KColorUtils::mix(badMatchColor, goodMatchColor, (( float )matchQuality) / 10.0); |
| 58 | |
| 59 | if (alternate) { |
| 60 | totalColor = doAlternate(totalColor); |
| 61 | } |
| 62 | |
| 63 | const float dynamicTint = 0.2f; |
| 64 | const float minimumTint = 0.2f; |
| 65 | double tintStrength = (dynamicTint * matchQuality) / 10; |
| 66 | if (tintStrength) { |
| 67 | tintStrength += minimumTint; //Some minimum tinting strength, else it's not visible any more |
| 68 | } |
| 69 | return KColorUtils::tint(background, totalColor, tintStrength).rgb(); |
| 70 | } else { |
| 71 | return 0; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | QVariant ExpandingWidgetModel::data(const QModelIndex& index, int role) const |
| 76 | { |
nothing calls this directly
no test coverage detected