Changeset 846 for trunk/src/gui/widgets/qsplitter.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/widgets/qsplitter.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) … … 125 125 /*! 126 126 Sets the orientation of the splitter handle to \a orientation. 127 This is usually prop ogated from the QSplitter.127 This is usually propagated from the QSplitter. 128 128 129 129 \sa QSplitter::setOrientation() … … 223 223 return parentWidget()->style()->sizeFromContents(QStyle::CT_Splitter, &opt, QSize(hw, hw), d->s) 224 224 .expandedTo(QApplication::globalStrut()); 225 } 226 227 /*! 228 \reimp 229 */ 230 void QSplitterHandle::resizeEvent(QResizeEvent *event) 231 { 232 Q_D(const QSplitterHandle); 233 234 // When splitters are only 1 pixel large we increase the 235 // actual grab area to five pixels 236 237 // Note that QSplitter uses contentsRect for layouting 238 // and ensures that handles are drawn on top of widgets 239 // We simply use the contents margins for draggin and only 240 // paint the mask area 241 bool useTinyMode = (d->s->handleWidth() == 1); 242 setAttribute(Qt::WA_MouseNoMask, useTinyMode); 243 if (useTinyMode) { 244 if (orientation() == Qt::Horizontal) 245 setContentsMargins(2, 0, 2, 0); 246 else 247 setContentsMargins(0, 2, 0, 2); 248 setMask(QRegion(contentsRect())); 249 } 250 251 QWidget::resizeEvent(event); 225 252 } 226 253 … … 302 329 QPainter p(this); 303 330 QStyleOption opt(0); 304 opt.rect = rect();331 opt.rect = contentsRect(); 305 332 opt.palette = palette(); 306 333 if (orientation() == Qt::Horizontal) … … 1277 1304 return; 1278 1305 QWidget *w = static_cast<QWidget*>(c->child()); 1279 1280 1306 if (c->added() && !d->blockChildAdd && !w->isWindow() && !d->findWidget(w)) { 1281 1307 d->insertWidget_helper(d->list.count(), w, false); … … 1307 1333 if (pos < 0) { 1308 1334 if (d->rubberBand) 1309 QTimer::singleShot(0, d->rubberBand, SLOT(deleteLater()));1335 d->rubberBand->deleteLater(); 1310 1336 return; 1311 1337 } … … 1314 1340 int hw = handleWidth(); 1315 1341 if (!d->rubberBand) { 1316 d->rubberBand = new QRubberBand(QRubberBand::Line); 1342 QBoolBlocker b(d->blockChildAdd); 1343 d->rubberBand = new QRubberBand(QRubberBand::Line, this); 1317 1344 // For accessibility to identify this special widget. 1318 1345 d->rubberBand->setObjectName(QLatin1String("qt_rubberband")); 1319 1346 } 1320 if (d->orient == Qt::Horizontal) 1321 d->rubberBand->setGeometry(QRect(QPoint(pos + hw / 2 - rBord, r.y()), 1322 QSize(2 * rBord, r.height())).translated(mapToGlobal(QPoint()))); 1323 else 1324 d->rubberBand->setGeometry(QRect(QPoint(r.x(), pos + hw / 2 - rBord), 1325 QSize(r.width(), 2 * rBord)).translated(mapToGlobal(QPoint()))); 1326 if (!d->rubberBand->isVisible()) 1327 d->rubberBand->show(); 1347 1348 const QRect newGeom = d->orient == Qt::Horizontal ? QRect(QPoint(pos + hw / 2 - rBord, r.y()), QSize(2 * rBord, r.height())) 1349 : QRect(QPoint(r.x(), pos + hw / 2 - rBord), QSize(r.width(), 2 * rBord)); 1350 d->rubberBand->setGeometry(newGeom); 1351 d->rubberBand->show(); 1328 1352 } 1329 1353 … … 1556 1580 int l = 0; 1557 1581 int t = 0; 1558 QObjectList childList = children(); 1559 for (int i = 0; i < childList.size(); ++i) { 1560 if (QWidget *w = qobject_cast<QWidget *>(childList.at(i))) { 1561 if (w->isHidden()) 1562 continue; 1563 QSize s = w->sizeHint(); 1564 if (s.isValid()) { 1565 l += d->pick(s); 1566 t = qMax(t, d->trans(s)); 1567 } 1582 for (int i = 0; i < d->list.size(); ++i) { 1583 QWidget *w = d->list.at(i)->widget; 1584 if (w->isHidden()) 1585 continue; 1586 QSize s = w->sizeHint(); 1587 if (s.isValid()) { 1588 l += d->pick(s); 1589 t = qMax(t, d->trans(s)); 1568 1590 } 1569 1591 } … … 1668 1690 By default, this property contains a value that depends on the user's platform 1669 1691 and style preferences. 1692 1693 If you set handleWidth to 1, the actual grab area will grow to overlap a 1694 few pixels of it's respective widgets. 1670 1695 */ 1671 1696
Note:
See TracChangeset
for help on using the changeset viewer.