Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qsplitter.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
     
    120120    Q_D(QSplitterHandle);
    121121    d->s = parent;
    122     d->hover = false;
    123122    setOrientation(orientation);
    124123}
     
    270269{
    271270    Q_D(QSplitterHandle);
    272     if (e->button() == Qt::LeftButton)
     271    if (e->button() == Qt::LeftButton) {
    273272        d->mouseOffset = d->pick(e->pos());
     273        d->pressed = true;
     274        update();
     275    }
    274276}
    275277
     
    285287        d->s->setRubberBand(-1);
    286288        moveSplitter(pos);
     289    }
     290    if (e->button() == Qt::LeftButton) {
     291        d->pressed = false;
     292        update();
    287293    }
    288294}
     
    304310    if (d->hover)
    305311        opt.state |= QStyle::State_MouseOver;
     312    if (d->pressed)
     313        opt.state |= QStyle::State_Sunken;
    306314    if (isEnabled())
    307315        opt.state |= QStyle::State_Enabled;
     
    353361    */
    354362    bool first = true;
     363    bool allInvisible = n != 0;
    355364    for (int i = 0; i < n ; ++i) {
    356365        QSplitterLayoutStruct *s = list.at(i);
    357         s->handle->setHidden(first || s->widget->isHidden());
    358         if (!s->widget->isHidden())
     366        bool widgetHidden = s->widget->isHidden();
     367        if (allInvisible && !widgetHidden && !s->collapsed)
     368            allInvisible = false;
     369        s->handle->setHidden(first || widgetHidden);
     370        if (!widgetHidden)
    359371            first = false;
    360372    }
     373
     374    if (allInvisible)
     375        for (int i = 0; i < n ; ++i) {
     376            QSplitterLayoutStruct *s = list.at(i);
     377            if (!s->widget->isHidden()) {
     378                s->collapsed = false;
     379                break;
     380            }
     381        }
    361382
    362383    int fi = 2 * q->frameWidth();
     
    390411
    391412    if (empty) {
    392         if (qobject_cast<QSplitter *>(q->parentWidget())) {
     413        if (qobject_cast<QSplitter *>(parent)) {
    393414            // nested splitters; be nice
    394415            maxl = maxt = 0;
     
    924945
    925946    \ingroup organizers
    926     \mainclass
     947
    927948
    928949    A splitter lets the user control the size of child widgets by dragging the
     
    15181539/*!
    15191540    \fn int QSplitter::margin() const
    1520     Returns the with of the the margin around the contents of the widget.
     1541    Returns the width of the margin around the contents of the widget.
    15211542
    15221543    Use QWidget::getContentsMargins() instead.
Note: See TracChangeset for help on using the changeset viewer.