Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/graphicsview/qgraphicslinearlayout.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    7676    an alignment for each item by calling setAlignment(), and check the
    7777    alignment for any item by calling alignment(). By default, items are
    78     centered both vertically and horizontally.
     78    aligned to the top left.
    7979
    8080    \section1 Spacing within QGraphicsLinearLayout
     
    148148    int index = gridItem->firstRow(orientation);
    149149    engine.removeItem(gridItem);
    150     engine.removeRow(index, orientation);
     150    engine.removeRows(index, 1, orientation);
    151151}
    152152
     
    172172}
    173173
     174Q_GLOBAL_STATIC(QWidget, globalStyleInfoWidget)
     175
    174176QLayoutStyleInfo QGraphicsLinearLayoutPrivate::styleInfo() const
    175177{
    176     static QWidget *wid = 0;
    177     if (!wid)
    178         wid = new QWidget;
    179178    QGraphicsItem *item = parentItem();
    180179    QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style();
    181     return QLayoutStyleInfo(style, wid);
     180    return QLayoutStyleInfo(style, globalStyleInfoWidget());
    182181}
    183182
     
    277276        return;
    278277    }
     278    Q_ASSERT(item);
     279
     280    //the order of the following instructions is very important because
     281    //invalidating the layout before adding the child item will make the layout happen
     282    //before we try to paint the item
     283    invalidate();
    279284    d->addChildLayoutItem(item);
    280285
    281     Q_ASSERT(item);
    282286    d->fixIndex(&index);
    283287    d->engine.insertRow(index, d->orientation);
    284288    new QGridLayoutItem(&d->engine, item, d->gridRow(index), d->gridColumn(index), 1, 1, 0, index);
    285     invalidate();
    286289}
    287290
     
    444447/*!
    445448    Returns the alignment for \a item. The default alignment is
    446     Qt::AlignCenter.
     449    Qt::AlignTop | Qt::AlignLeft.
    447450
    448451    The alignment decides how the item is positioned within its assigned space
     
    530533    qreal left, top, right, bottom;
    531534    getContentsMargins(&left, &top, &right, &bottom);
    532     return d->engine.sizeHint(d->styleInfo(), which , constraint) + QSizeF(left + right, top + bottom);
     535    const QSizeF extraMargins(left + right, top + bottom);
     536    return d->engine.sizeHint(d->styleInfo(), which , constraint - extraMargins) + extraMargins;
    533537}
    534538
     
    555559        d->engine.dump(indent + 1);
    556560    }
     561#else
     562    Q_UNUSED(indent);
    557563#endif
    558564}
Note: See TracChangeset for help on using the changeset viewer.