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/widgets/qsplitter.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)
     
    125125/*!
    126126    Sets the orientation of the splitter handle to \a orientation.
    127     This is usually propogated from the QSplitter.
     127    This is usually propagated from the QSplitter.
    128128
    129129    \sa QSplitter::setOrientation()
     
    223223    return parentWidget()->style()->sizeFromContents(QStyle::CT_Splitter, &opt, QSize(hw, hw), d->s)
    224224        .expandedTo(QApplication::globalStrut());
     225}
     226
     227/*!
     228    \reimp
     229*/
     230void 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);
    225252}
    226253
     
    302329    QPainter p(this);
    303330    QStyleOption opt(0);
    304     opt.rect = rect();
     331    opt.rect = contentsRect();
    305332    opt.palette = palette();
    306333    if (orientation() == Qt::Horizontal)
     
    12771304        return;
    12781305    QWidget *w = static_cast<QWidget*>(c->child());
    1279 
    12801306    if (c->added() && !d->blockChildAdd && !w->isWindow() && !d->findWidget(w)) {
    12811307        d->insertWidget_helper(d->list.count(), w, false);
     
    13071333    if (pos < 0) {
    13081334        if (d->rubberBand)
    1309             QTimer::singleShot(0, d->rubberBand, SLOT(deleteLater()));
     1335            d->rubberBand->deleteLater();
    13101336        return;
    13111337    }
     
    13141340    int hw = handleWidth();
    13151341    if (!d->rubberBand) {
    1316         d->rubberBand = new QRubberBand(QRubberBand::Line);
     1342        QBoolBlocker b(d->blockChildAdd);
     1343        d->rubberBand = new QRubberBand(QRubberBand::Line, this);
    13171344        // For accessibility to identify this special widget.
    13181345        d->rubberBand->setObjectName(QLatin1String("qt_rubberband"));
    13191346    }
    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();
    13281352}
    13291353
     
    15561580    int l = 0;
    15571581    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));
    15681590        }
    15691591    }
     
    16681690    By default, this property contains a value that depends on the user's platform
    16691691    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.
    16701695*/
    16711696
Note: See TracChangeset for help on using the changeset viewer.