~zsombi/ubuntu-ui-toolkit/pleaseBottomEdgePreloadUrl

« back to all changes in this revision

Viewing changes to src/Ubuntu/UbuntuToolkit/ucstylehints.cpp

Fix assigning of constant values to a grouped property in StyleHints. Fixes: https://bugs.launchpad.net/bugs/1602836.

Approved by ubuntu-sdk-build-bot, Zsombor Egri.

Show diffs side-by-side

added added

removed removed

Lines of Context:
225
225
    m_propertyBackup.clear();
226
226
 
227
227
    QQuickItem *item = UCStyledItemBasePrivate::get(m_styledItem)->styleItem;
228
 
    const QMetaObject *mo = item->metaObject();
229
228
    const QString styleName = UCStyledItemBasePrivate::get(m_styledItem)->styleName();
230
229
    // apply values first
231
230
    for (int i = 0; i < m_values.size(); i++) {
232
 
        if (mo->indexOfProperty(m_values[i].first.toUtf8()) < 0) {
 
231
        // Checking the validity of the property using the index of m_values[i].first in
 
232
        //  item->metaObject is not sufficient in case of a grouped property, so we use
 
233
        //  PropertyChange to detect all properties that are not valid.
 
234
        PropertyChange *change = new PropertyChange(item, m_values[i].first.toUtf8());
 
235
        if (!change->property().isValid()) {
233
236
            propertyNotFound(styleName, m_values[i].first);
 
237
            delete change;
234
238
            continue;
235
239
        }
236
 
        PropertyChange *change = new PropertyChange(item, m_values[i].first.toUtf8());
237
240
        PropertyChange::setValue(change, m_values[i].second);
238
241
        m_propertyBackup << change;
239
242
    }