Changeset 561 for trunk/src/gui/graphicsview/qgraphicslayoutitem.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/gui/graphicsview/qgraphicslayoutitem.cpp (modified) (20 diffs)
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/qgraphicslayoutitem.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 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 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 109 109 */ 110 110 QGraphicsLayoutItemPrivate::QGraphicsLayoutItemPrivate(QGraphicsLayoutItem *par, bool layout) 111 : parent(par), isLayout(layout), ownedByLayout(false), graphicsItem(0) 112 { 111 : parent(par), userSizeHints(0), isLayout(layout), ownedByLayout(false), graphicsItem(0) 112 { 113 } 114 115 /*! 116 \internal 117 */ 118 QGraphicsLayoutItemPrivate::~QGraphicsLayoutItemPrivate() 119 { 120 // Remove any lazily allocated data 121 delete[] userSizeHints; 113 122 } 114 123 … … 133 142 for (int i = 0; i < Qt::NSizeHints; ++i) { 134 143 cachedSizeHints[i] = constraint; 135 combineSize(cachedSizeHints[i], userSizeHints[i]); 144 if (userSizeHints) 145 combineSize(cachedSizeHints[i], userSizeHints[i]); 136 146 } 137 147 … … 199 209 200 210 /*! 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 201 263 \class QGraphicsLayoutItem 202 264 \brief The QGraphicsLayoutItem class can be inherited to allow your custom 203 265 items to be managed by layouts. 204 266 \since 4.4 205 \ingroup multimedia206 267 \ingroup graphicsview-api 207 268 … … 256 317 protected constructor, or by calling setParentLayoutItem(). The 257 318 parentLayoutItem() function returns a pointer to the item's layoutItem 258 parent. If the item's parent is 0 or if the theparent does not inherit319 parent. If the item's parent is 0 or if the parent does not inherit 259 320 from QGraphicsItem, the parentLayoutItem() function then returns 0. 260 321 isLayout() returns true if the QGraphicsLayoutItem subclass is itself a … … 308 369 } 309 370 } 310 delete d_ptr;311 371 } 312 372 … … 382 442 void QGraphicsLayoutItem::setMinimumSize(const QSizeF &size) 383 443 { 384 Q_D(QGraphicsLayoutItem); 385 if (size == d->userSizeHints[Qt::MinimumSize]) 386 return; 387 388 d->userSizeHints[Qt::MinimumSize] = size; 389 updateGeometry(); 444 d_ptr->setSize(Qt::MinimumSize, size); 390 445 } 391 446 … … 417 472 void QGraphicsLayoutItem::setMinimumWidth(qreal width) 418 473 { 419 Q_D(QGraphicsLayoutItem); 420 qreal &userSizeHint = d->userSizeHints[Qt::MinimumSize].rwidth(); 421 if (width == userSizeHint) 422 return; 423 userSizeHint = width; 424 updateGeometry(); 474 d_ptr->setSizeComponent(Qt::MinimumSize, d_ptr->Width, width); 425 475 } 426 476 … … 432 482 void QGraphicsLayoutItem::setMinimumHeight(qreal height) 433 483 { 434 Q_D(QGraphicsLayoutItem); 435 qreal &userSizeHint = d->userSizeHints[Qt::MinimumSize].rheight(); 436 if (height == userSizeHint) 437 return; 438 userSizeHint = height; 439 updateGeometry(); 484 d_ptr->setSizeComponent(Qt::MinimumSize, d_ptr->Height, height); 440 485 } 441 486 … … 451 496 void QGraphicsLayoutItem::setPreferredSize(const QSizeF &size) 452 497 { 453 Q_D(QGraphicsLayoutItem); 454 if (size == d->userSizeHints[Qt::PreferredSize]) 455 return; 456 457 d->userSizeHints[Qt::PreferredSize] = size; 458 updateGeometry(); 498 d_ptr->setSize(Qt::PreferredSize, size); 459 499 } 460 500 … … 486 526 void QGraphicsLayoutItem::setPreferredHeight(qreal height) 487 527 { 488 Q_D(QGraphicsLayoutItem); 489 qreal &userSizeHint = d->userSizeHints[Qt::PreferredSize].rheight(); 490 if (height == userSizeHint) 491 return; 492 userSizeHint = height; 493 updateGeometry(); 528 d_ptr->setSizeComponent(Qt::PreferredSize, d_ptr->Height, height); 494 529 } 495 530 … … 501 536 void QGraphicsLayoutItem::setPreferredWidth(qreal width) 502 537 { 503 Q_D(QGraphicsLayoutItem); 504 qreal &userSizeHint = d->userSizeHints[Qt::PreferredSize].rwidth(); 505 if (width == userSizeHint) 506 return; 507 userSizeHint = width; 508 updateGeometry(); 538 d_ptr->setSizeComponent(Qt::PreferredSize, d_ptr->Width, width); 509 539 } 510 540 … … 520 550 void QGraphicsLayoutItem::setMaximumSize(const QSizeF &size) 521 551 { 522 Q_D(QGraphicsLayoutItem); 523 if (size == d->userSizeHints[Qt::MaximumSize]) 524 return; 525 526 d->userSizeHints[Qt::MaximumSize] = size; 527 updateGeometry(); 552 d_ptr->setSize(Qt::MaximumSize, size); 528 553 } 529 554 … … 555 580 void QGraphicsLayoutItem::setMaximumWidth(qreal width) 556 581 { 557 Q_D(QGraphicsLayoutItem); 558 qreal &userSizeHint = d->userSizeHints[Qt::MaximumSize].rwidth(); 559 if (width == userSizeHint) 560 return; 561 userSizeHint = width; 562 updateGeometry(); 582 d_ptr->setSizeComponent(Qt::MaximumSize, d_ptr->Width, width); 563 583 } 564 584 … … 570 590 void QGraphicsLayoutItem::setMaximumHeight(qreal height) 571 591 { 572 Q_D(QGraphicsLayoutItem); 573 qreal &userSizeHint = d->userSizeHints[Qt::MaximumSize].rheight(); 574 if (height == userSizeHint) 575 return; 576 userSizeHint = height; 577 updateGeometry(); 592 d_ptr->setSizeComponent(Qt::MaximumSize, d_ptr->Height, height); 578 593 } 579 594 … … 733 748 QSizeF QGraphicsLayoutItem::effectiveSizeHint(Qt::SizeHint which, const QSizeF &constraint) const 734 749 { 750 751 752 753 754 735 755 // ### should respect size policy??? 736 756 return d_ptr->effectiveSizeHints(constraint)[which]; … … 787 807 788 808 /*! 809 810 789 811 Returns whether a layout should delete this item in its destructor. 790 812 If its true, then the layout will delete it. If its false, then it is … … 813 835 } 814 836 /*! 837 838 815 839 Sets whether a layout should delete this item in its destructor or not. 816 840 \a ownership must be true to in order for the layout to delete it.
Note:
See TracChangeset
for help on using the changeset viewer.
