Changeset 561 for trunk/src/gui/graphicsview/qgraphicslinearlayout.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/graphicsview/qgraphicslinearlayout.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 45 45 layout for managing widgets in Graphics View. 46 46 \since 4.4 47 \ingroup multimedia48 47 \ingroup graphicsview-api 49 48 … … 61 60 You can add widgets, layouts, stretches (addStretch(), insertStretch() or 62 61 setStretchFactor()), and spacings (setItemSpacing()) to a linear 63 layout. The layout takes ownership of the items. In some cases when the layout 62 layout. The layout takes ownership of the items. In some cases when the layout 64 63 item also inherits from QGraphicsItem (such as QGraphicsWidget) there will be a 65 64 ambiguity in ownership because the layout item belongs to two ownership hierarchies. … … 179 178 wid = new QWidget; 180 179 QGraphicsItem *item = parentItem(); 181 QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : qApp->style();180 QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style(); 182 181 return QLayoutStyleInfo(style, wid); 183 182 } … … 210 209 QGraphicsLayoutItem *item = itemAt(i); 211 210 // The following lines can be removed, but this removes the item 212 // from the layout more efficiently than the implementation of 211 // from the layout more efficiently than the implementation of 213 212 // ~QGraphicsLayoutItem. 214 213 removeAt(i); … … 274 273 return; 275 274 } 275 if (item == this) { 276 qWarning("QGraphicsLinearLayout::insertItem: cannot insert itself"); 277 return; 278 } 276 279 d->addChildLayoutItem(item); 277 280 … … 279 282 d->fixIndex(&index); 280 283 d->engine.insertRow(index, d->orientation); 281 new QGridLayoutItem(&d->engine, item, d->gridRow(index), d->gridColumn(index) );284 new QGridLayoutItem(&d->engine, item, d->gridRow(index), d->gridColumn(index), 1, 1, 0, index); 282 285 invalidate(); 283 286 } … … 324 327 { 325 328 Q_D(QGraphicsLinearLayout); 326 if (QGridLayoutItem *gridItem = d->engine.itemAt(d->gridRow(index), d->gridColumn(index))) { 329 if (index < 0 || index >= d->engine.itemCount()) { 330 qWarning("QGraphicsLinearLayout::removeAt: invalid index %d", index); 331 return; 332 } 333 if (QGridLayoutItem *gridItem = d->engine.itemAt(index)) { 327 334 if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem()) 328 335 layoutItem->setParentLayoutItem(0); … … 464 471 { 465 472 Q_D(const QGraphicsLinearLayout); 466 return d->engine. rowCount(d->orientation);473 return d->engine.itemCount(); 467 474 } 468 475 469 476 /*! 470 477 \reimp 478 When iterating from 0 and up, it will return the items in the visual arranged order. 471 479 */ 472 480 QGraphicsLayoutItem *QGraphicsLinearLayout::itemAt(int index) const 473 481 { 474 482 Q_D(const QGraphicsLinearLayout); 483 if (index < 0 || index >= d->engine.itemCount()) { 484 qWarning("QGraphicsLinearLayout::itemAt: invalid index %d", index); 485 return 0; 486 } 475 487 QGraphicsLayoutItem *item = 0; 476 if (QGridLayoutItem *gridItem = d->engine.itemAt( d->gridRow(index), d->gridColumn(index)))488 if (QGridLayoutItem *gridItem = d->engine.itemAt(index)) 477 489 item = gridItem->layoutItem(); 478 490 return item; … … 531 543 } 532 544 545 /*! 546 \internal 547 */ 548 void QGraphicsLinearLayout::dump(int indent) const 549 { 533 550 #ifdef QT_DEBUG 534 void QGraphicsLinearLayout::dump(int indent) const535 {536 551 if (qt_graphicsLayoutDebug()) { 537 552 Q_D(const QGraphicsLinearLayout); … … 540 555 d->engine.dump(indent + 1); 541 556 } 542 }543 557 #endif 558 } 544 559 545 560 QT_END_NAMESPACE 546 561 547 562 #endif //QT_NO_GRAPHICSVIEW
Note:
See TracChangeset
for help on using the changeset viewer.