Code review comment for lp:~zsombi/ubuntu-ui-toolkit/76-refactoring

Revision history for this message
Tim Peeters (tpeeters) wrote :

void UCListItem::setHighlightColor(const QColor &color)
{
    Q_D(UCListItem);
    if (d->highlightColor == color) {
        return;
    }
    d->highlightColor = color;
    // no more theme change watch
    d->customColor = true;
    update();
    Q_EMIT highlightColorChanged();
}
void UCListItem::resetHighlightColor()
{
    Q_D(UCListItem);
    d->customColor = false;
    d->highlightColor = getPaletteColor("selected", "background");
    update();
    Q_EMIT highlightColorChanged();
}

if you call setHighlightColor(color) // color == getPaletteColor("selected", "background") then customColor is not set to true, and you are still watching for palette updates, while it may be purely coincidence that you set the color to the palette color. So customColor = true should be moved before the if() (maybe update() too).

« Back to merge proposal