Changeset 561 for trunk/src/gui/itemviews/qtreeview_p.h
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
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/itemviews/qtreeview_p.h
r2 r561 2 2 ** 3 3 ** 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) 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 have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 55 55 56 56 #include "private/qabstractitemview_p.h" 57 #include <QtCore/qvariantanimation.h> 57 58 58 59 #ifndef QT_NO_TREEVIEW … … 62 63 struct QTreeViewItem 63 64 { 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) {} 65 67 QModelIndex index; // we remove items whenever the indexes are invalidated 66 68 uint expanded : 1; 67 69 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 69 73 uint level : 16; // indentation 70 74 int height : 16; // row height … … 82 86 itemsExpandable(true), sortingEnabled(false), 83 87 expandsOnDoubleClick(true), 84 allColumnsShowFocus(false), 88 allColumnsShowFocus(false), current(0), spanning(false), 85 89 animationsEnabled(false), columnResizeTimerID(0), 86 90 autoExpandDelay(-1), hoverBranch(-1), geometryRecursionBlock(false) {} … … 89 93 void initialize(); 90 94 91 struct AnimatedOperation 95 QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; 96 97 #ifndef QT_NO_ANIMATION 98 struct AnimatedOperation : public QVariantAnimation 92 99 { 93 enum Type { Expand, Collapse };94 100 int item; 95 int top;96 int duration;97 Type type;98 101 QPixmap before; 99 102 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 101 116 102 117 void expand(int item, bool emitSignal); 103 118 void collapse(int item, bool emitSignal); 104 119 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() const112 { return QRect(0, animatedOperation.top, viewport->width(),113 viewport->height() - animatedOperation.top); }114 115 void _q_currentChanged(const QModelIndex&, const QModelIndex&);116 120 void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int); 117 121 void _q_columnsRemoved(const QModelIndex &, int, int); 118 122 void _q_modelAboutToBeReset(); 119 void _q_animate();120 123 void _q_sortIndicatorChanged(int column, Qt::SortOrder order); 121 124 void _q_modelDestroyed(); … … 178 181 // used when expanding and collapsing items 179 182 QSet<QPersistentModelIndex> expandedIndexes; 180 QStack<bool> expandParent;181 AnimatedOperation animatedOperation;182 183 bool animationsEnabled; 183 184
Note:
See TracChangeset
for help on using the changeset viewer.