src/gui/itemviews/qtreeview_p.h
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    60 
    60 
    61 QT_BEGIN_NAMESPACE
    61 QT_BEGIN_NAMESPACE
    62 
    62 
    63 struct QTreeViewItem
    63 struct QTreeViewItem
    64 {
    64 {
    65     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) {}
    66     QModelIndex index; // we remove items whenever the indexes are invalidated
    67     QModelIndex index; // we remove items whenever the indexes are invalidated
    67     uint expanded : 1;
    68     uint expanded : 1;
    68     uint spanning : 1;
    69     uint spanning : 1;
    69     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
    70     uint level : 16; // indentation
    73     uint level : 16; // indentation
    71     int height : 16; // row height
    74     int height : 16; // row height
    72 };
    75 };
    73 
    76 
    74 class QTreeViewPrivate : public QAbstractItemViewPrivate
    77 class QTreeViewPrivate : public QAbstractItemViewPrivate
   100         QWidget *viewport;
   103         QWidget *viewport;
   101         AnimatedOperation() : item(0) { setEasingCurve(QEasingCurve::InOutQuad); }
   104         AnimatedOperation() : item(0) { setEasingCurve(QEasingCurve::InOutQuad); }
   102         int top() const { return startValue().toInt(); }
   105         int top() const { return startValue().toInt(); }
   103         QRect rect() const { QRect rect = viewport->rect(); rect.moveTop(top()); return rect; }
   106         QRect rect() const { QRect rect = viewport->rect(); rect.moveTop(top()); return rect; }
   104         void updateCurrentValue(const QVariant &) { viewport->update(rect()); }
   107         void updateCurrentValue(const QVariant &) { viewport->update(rect()); }
   105         void updateState(State, State state) { if (state == Stopped) before = after = QPixmap(); }
   108         void updateState(State state, State) { if (state == Stopped) before = after = QPixmap(); }
   106     } animatedOperation;
   109     } animatedOperation;
   107     void prepareAnimatedOperation(int item, QVariantAnimation::Direction d);
   110     void prepareAnimatedOperation(int item, QVariantAnimation::Direction d);
   108     void beginAnimatedOperation();
   111     void beginAnimatedOperation();
   109     void drawAnimatedOperation(QPainter *painter) const;
   112     void drawAnimatedOperation(QPainter *painter) const;
   110     QPixmap renderTreeToPixmapForAnimation(const QRect &rect) const;
   113     QPixmap renderTreeToPixmapForAnimation(const QRect &rect) const;