Changeset 846 for trunk/src/gui/graphicsview/qgraphicslinearlayout.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/graphicsview/qgraphicslinearlayout.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 76 76 an alignment for each item by calling setAlignment(), and check the 77 77 alignment for any item by calling alignment(). By default, items are 78 centered both vertically and horizontally.78 aligned to the top left. 79 79 80 80 \section1 Spacing within QGraphicsLinearLayout … … 148 148 int index = gridItem->firstRow(orientation); 149 149 engine.removeItem(gridItem); 150 engine.removeRow (index, orientation);150 engine.removeRows(index, 1, orientation); 151 151 } 152 152 … … 172 172 } 173 173 174 Q_GLOBAL_STATIC(QWidget, globalStyleInfoWidget) 175 174 176 QLayoutStyleInfo QGraphicsLinearLayoutPrivate::styleInfo() const 175 177 { 176 static QWidget *wid = 0;177 if (!wid)178 wid = new QWidget;179 178 QGraphicsItem *item = parentItem(); 180 179 QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style(); 181 return QLayoutStyleInfo(style, wid);180 return QLayoutStyleInfo(style, globalStyleInfoWidget()); 182 181 } 183 182 … … 277 276 return; 278 277 } 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(); 279 284 d->addChildLayoutItem(item); 280 285 281 Q_ASSERT(item);282 286 d->fixIndex(&index); 283 287 d->engine.insertRow(index, d->orientation); 284 288 new QGridLayoutItem(&d->engine, item, d->gridRow(index), d->gridColumn(index), 1, 1, 0, index); 285 invalidate();286 289 } 287 290 … … 444 447 /*! 445 448 Returns the alignment for \a item. The default alignment is 446 Qt::Align Center.449 Qt::AlignTop | Qt::AlignLeft. 447 450 448 451 The alignment decides how the item is positioned within its assigned space … … 530 533 qreal left, top, right, bottom; 531 534 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; 533 537 } 534 538 … … 555 559 d->engine.dump(indent + 1); 556 560 } 561 #else 562 Q_UNUSED(indent); 557 563 #endif 558 564 }
Note:
See TracChangeset
for help on using the changeset viewer.