コード例 #1
0
ファイル: qgraphicslayout.cpp プロジェクト: Afreeca/qt
/*!
    \reimp
*/
void QGraphicsLayout::updateGeometry()
{
    Q_D(QGraphicsLayout);
    if (QGraphicsLayout::instantInvalidatePropagation()) {
        d->activated = false;
        QGraphicsLayoutItem::updateGeometry();

        QGraphicsLayoutItem *parentItem = parentLayoutItem();
        if (!parentItem)
            return;

        if (parentItem->isLayout())
            static_cast<QGraphicsLayout *>(parentItem)->invalidate();
        else
            parentItem->updateGeometry();
    } else {
        QGraphicsLayoutItem::updateGeometry();
        if (QGraphicsLayoutItem *parentItem = parentLayoutItem()) {
            if (parentItem->isLayout()) {
                parentItem->updateGeometry();
            } else {
                invalidate();
            }
        }
    }
}
コード例 #2
0
void MMessageBoxViewPrivate::updateLayout()
{
    clearLayout();
    prepareLayout();

    if (centralWidget) {
        contentsLayout->insertItem(0, centralWidget);
    }

    if (textLabel) {
        contentsLayout->insertItem(0, textLabel);
        contentsLayout->setAlignment(textLabel, Qt::AlignCenter);
    }

    if (titleLabel) {
        contentsLayout->insertItem(0, titleLabel);
        contentsLayout->setAlignment(titleLabel, Qt::AlignCenter);
    }

    if (iconImage) {
        contentsLayout->insertItem(0, iconImage);
        contentsLayout->setAlignment(iconImage, Qt::AlignCenter);
    }

    if (!QGraphicsLayout::instantInvalidatePropagation()) {
        /* Update the geometry of the parents immediately. This simply makes the layout have the correct sizehint
         * immediately instead of one frame later, removing a single frame of 'flicker'.
         */
        QGraphicsLayoutItem *item = contents;
        do {
            item->updateGeometry();
        } while( (item = item->parentLayoutItem()) );
    }
}