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/itemviews/qtreeview_p.h

    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**
     
    5555
    5656#include "private/qabstractitemview_p.h"
     57#include <QtCore/qvariantanimation.h>
    5758
    5859#ifndef QT_NO_TREEVIEW
     
    6263struct QTreeViewItem
    6364{
    64     QTreeViewItem() : expanded(false), spanning(false), total(0), level(0), height(0) {}
     65    QTreeViewItem() : expanded(false), spanning(false), hasChildren(false),
     66                      hasMoreSiblings(false), total(0), level(0), height(0) {}
    6567    QModelIndex index; // we remove items whenever the indexes are invalidated
    6668    uint expanded : 1;
    6769    uint spanning : 1;
    68     uint total : 30; // total number of children visible
     70    uint hasChildren : 1; // if the item has visible children (even if collapsed)
     71    uint hasMoreSiblings : 1;
     72    uint total : 28; // total number of children visible
    6973    uint level : 16; // indentation
    7074    int height : 16; // row height
     
    8286          itemsExpandable(true), sortingEnabled(false),
    8387          expandsOnDoubleClick(true),
    84           allColumnsShowFocus(false),
     88          allColumnsShowFocus(false), current(0), spanning(false),
    8589          animationsEnabled(false), columnResizeTimerID(0),
    8690          autoExpandDelay(-1), hoverBranch(-1), geometryRecursionBlock(false) {}
     
    8993    void initialize();
    9094
    91     struct AnimatedOperation
     95    QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const;
     96
     97#ifndef QT_NO_ANIMATION
     98    struct AnimatedOperation : public QVariantAnimation
    9299    {
    93         enum Type { Expand, Collapse };
    94100        int item;
    95         int top;
    96         int duration;
    97         Type type;
    98101        QPixmap before;
    99102        QPixmap after;
    100     };
     103        QWidget *viewport;
     104        AnimatedOperation() : item(0) { setEasingCurve(QEasingCurve::InOutQuad); }
     105        int top() const { return startValue().toInt(); }
     106        QRect rect() const { QRect rect = viewport->rect(); rect.moveTop(top()); return rect; }
     107        void updateCurrentValue(const QVariant &) { viewport->update(rect()); }
     108        void updateState(State state, State) { if (state == Stopped) before = after = QPixmap(); }
     109    } animatedOperation;
     110    void prepareAnimatedOperation(int item, QVariantAnimation::Direction d);
     111    void beginAnimatedOperation();
     112    void drawAnimatedOperation(QPainter *painter) const;
     113    QPixmap renderTreeToPixmapForAnimation(const QRect &rect) const;
     114    void _q_endAnimatedOperation();
     115#endif //QT_NO_ANIMATION
    101116
    102117    void expand(int item, bool emitSignal);
    103118    void collapse(int item, bool emitSignal);
    104119
    105     void prepareAnimatedOperation(int item, AnimatedOperation::Type type);
    106     void beginAnimatedOperation();
    107     void _q_endAnimatedOperation();
    108     void drawAnimatedOperation(QPainter *painter) const;
    109     QPixmap renderTreeToPixmapForAnimation(const QRect &rect) const;
    110 
    111     inline QRect animationRect() const
    112         { return QRect(0, animatedOperation.top, viewport->width(),
    113                        viewport->height() - animatedOperation.top); }
    114 
    115     void _q_currentChanged(const QModelIndex&, const QModelIndex&);
    116120    void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int);
    117121    void _q_columnsRemoved(const QModelIndex &, int, int);
    118122    void _q_modelAboutToBeReset();
    119     void _q_animate();
    120123    void _q_sortIndicatorChanged(int column, Qt::SortOrder order);
    121124    void _q_modelDestroyed();
     
    178181    // used when expanding and collapsing items
    179182    QSet<QPersistentModelIndex> expandedIndexes;
    180     QStack<bool> expandParent;
    181     AnimatedOperation animatedOperation;
    182183    bool animationsEnabled;
    183184
Note: See TracChangeset for help on using the changeset viewer.