void MGridLayoutPolicyPrivate::refreshEngine()
{
    engineWidget->setLayoutDirection(layout->layoutDirection());

    //To properly relayout or get the size hint, we need to invalidate the size hints
    //of all the proxy items and set the geometry of the proxy layout (d->engine) to be the same
    for (int i = engine->count() - 1; i >= 0; --i) {
        ProxyItem *item = static_cast<ProxyItem *>(engine->itemAt(i));
        item->refresh();
    }
    qreal left, top, right, bottom;
    layout->getContentsMargins(&left, &top, &right, &bottom);
    engine->setContentsMargins(left, top, right, bottom);

    engine->updateGeometry();
}
void MLinearLayoutPolicyPrivate::refreshEngine()
{
    //Make sure that we have our RTL/LTR correct
    bool directionChanged = engineWidget->layoutDirection() != layout->layoutDirection();
    if (directionChanged)
        engineWidget->setLayoutDirection(layout->layoutDirection());

    for (int i = engine->count() - 1; i >= 0; --i) {
        ProxyItem *item = static_cast<ProxyItem *>(engine->itemAt(i));
        item->refresh();
    }
    qreal left, top, right, bottom;
    layout->getContentsMargins(&left, &top, &right, &bottom);
    engine->setContentsMargins(left, top, right, bottom);

    engine->updateGeometry();

    if (directionChanged && notifyWidgetsOfLayoutPositionEnabled)
        notifyAllWidgetsOfLayoutPosition();
}