File indexing completed on 2024-05-12 05:43:25

0001 /* This file is part of KCachegrind.
0002    Copyright (c) 2002-2016 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
0003 
0004    KCachegrind is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation, version 2.
0007 
0008    This program is distributed in the hope that it will be useful,
0009    but WITHOUT ANY WARRANTY; without even the implied warranty of
0010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0011    General Public License for more details.
0012 
0013    You should have received a copy of the GNU General Public License
0014    along with this program; see the file COPYING.  If not, write to
0015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0016    Boston, MA 02110-1301, USA.
0017 */
0018 
0019 /**
0020  * A Widget for visualizing hierarchical metrics as areas.
0021  * The API is similar to QListView.
0022  *
0023  * This file defines the following classes:
0024  *  DrawParams, RectDrawing, TreeMapItem, TreeMapWidget
0025  *
0026  * DrawParams/RectDrawing allows reusing of TreeMap drawing
0027  * functions in other widgets.
0028  */
0029 
0030 #ifndef TREEMAP_H
0031 #define TREEMAP_H
0032 
0033 #include <QString>
0034 #include <QWidget>
0035 #include <QPixmap>
0036 #include <QColor>
0037 #include <QStringList>
0038 #include <QPaintEvent>
0039 #include <QKeyEvent>
0040 #include <QContextMenuEvent>
0041 #include <QMouseEvent>
0042 
0043 class QMenu;
0044 class TreeMapWidget;
0045 class TreeMapItem;
0046 class TreeMapItemList;
0047 
0048 
0049 /**
0050  * Drawing parameters for an object.
0051  * A Helper Interface for RectDrawing.
0052  */
0053 class DrawParams
0054 {
0055 public:
0056     /**
0057      * Positions for drawing into a rectangle.
0058      *
0059      * The specified position assumes no rotation.
0060      * If there is more than one text for one position, it is put
0061      * nearer to the center of the item.
0062      *
0063      * Drawing at top positions cuts free space from top,
0064      * drawing at bottom positions cuts from bottom.
0065      * Default usually gives positions clockwise according to field number.
0066      */
0067     enum Position { TopLeft, TopCenter, TopRight,
0068                     BottomLeft, BottomCenter, BottomRight,
0069                     Default, Unknown};
0070 
0071     // no constructor as this is an abstract class
0072     virtual ~DrawParams() {}
0073 
0074     virtual QString  text(int) const = 0;
0075     virtual QPixmap  pixmap(int) const = 0;
0076     virtual Position position(int) const = 0;
0077     // 0: no limit, negative: leave at least -maxLines() free
0078     virtual int      maxLines(int) const { return 0; }
0079     // allow breaking up content into multiple lines?
0080     virtual bool     allowBreak(int) const { return true; }
0081     // truncate or show nothing if space not enough?
0082     virtual bool     allowTruncation(int) const { return true; }
0083     virtual int      fieldCount() const { return 0; }
0084 
0085     virtual QColor   backColor() const { return Qt::white; }
0086     virtual const QFont& font() const = 0;
0087 
0088     virtual bool selected() const { return false; }
0089     virtual bool current() const { return false; }
0090     virtual bool shaded() const { return true; }
0091     virtual bool rotated() const { return false; }
0092     virtual bool drawFrame() const { return true; }
0093 };
0094 
0095 
0096 /*
0097  * DrawParam with attributes stored
0098  */
0099 class StoredDrawParams: public DrawParams
0100 {
0101 public:
0102     StoredDrawParams();
0103     explicit StoredDrawParams(const QColor& c,
0104                               bool selected = false, bool current = false);
0105 
0106     // getters
0107     QString  text(int) const override;
0108     QPixmap  pixmap(int) const override;
0109     Position position(int) const override;
0110     int      maxLines(int) const override;
0111     int      fieldCount() const override { return _field.size(); }
0112 
0113     QColor   backColor() const override { return _backColor; }
0114     bool selected() const override { return _selected; }
0115     bool current() const override { return _current; }
0116     bool shaded() const override { return _shaded; }
0117     bool rotated() const override { return _rotated; }
0118     bool drawFrame() const override { return _drawFrame; }
0119 
0120     const QFont& font() const override;
0121 
0122     // attribute setters
0123     void setField(int f, const QString& t, const QPixmap& pm = QPixmap(),
0124                   Position p = Default, int maxLines = 0);
0125     void setText(int f, const QString&);
0126     void setPixmap(int f, const QPixmap&);
0127     void setPosition(int f, Position);
0128     void setMaxLines(int f, int);
0129     void setBackColor(const QColor& c) { _backColor = c; }
0130     void setSelected(bool b) { _selected = b; }
0131     void setCurrent(bool b) { _current = b; }
0132     void setShaded(bool b) { _shaded = b; }
0133     void setRotated(bool b) { _rotated = b; }
0134     void drawFrame(bool b) { _drawFrame = b; }
0135 
0136 protected:
0137     QColor _backColor;
0138     bool _selected :1;
0139     bool _current :1;
0140     bool _shaded :1;
0141     bool _rotated :1;
0142     bool _drawFrame :1;
0143 
0144 private:
0145     // resize field array if needed to allow to access field <f>
0146     void ensureField(int f);
0147 
0148     struct Field {
0149         QString text;
0150         QPixmap pix;
0151         Position pos;
0152         int maxLines;
0153     };
0154 
0155     QVector<Field> _field;
0156 };
0157 
0158 
0159 /* State for drawing on a rectangle.
0160  *
0161  * Following drawing functions are provided:
0162  * - background drawing with shading and 3D frame
0163  * - successive pixmap/text drawing at various positions with wrap-around
0164  *   optimized for minimal space usage (e.g. if a text is drawn at top right
0165  *   after text on top left, the same line is used if space allows)
0166  *
0167  */
0168 class RectDrawing
0169 {
0170 public:
0171     explicit RectDrawing(const QRect&);
0172     ~RectDrawing();
0173 
0174     // The default DrawParams object used.
0175     DrawParams* drawParams();
0176     // we take control over the given object (i.e. delete at destruction)
0177     void setDrawParams(DrawParams*);
0178 
0179     // draw on a given QPainter, use this class as info provider per default
0180     void drawBack(QPainter*, DrawParams* dp = nullptr);
0181     /* Draw field at position() from pixmap()/text() with maxLines().
0182      * Returns true if something was drawn
0183      */
0184     bool drawField(QPainter*, int f, DrawParams* dp = nullptr);
0185 
0186     // resets rectangle for free space
0187     void setRect(const QRect&);
0188 
0189     // Returns the rectangle area still free of text/pixmaps after
0190     // a number of drawText() calls.
0191     QRect remainingRect(DrawParams* dp = nullptr);
0192 
0193 private:
0194     int _usedTopLeft, _usedTopCenter, _usedTopRight;
0195     int _usedBottomLeft, _usedBottomCenter, _usedBottomRight;
0196     QRect _rect;
0197 
0198     // temporary
0199     int _fontHeight;
0200     QFontMetrics* _fm;
0201     DrawParams* _dp;
0202 };
0203 
0204 
0205 class TreeMapItemList: public QList<TreeMapItem*>
0206 {
0207 public:
0208     TreeMapItem* commonParent();
0209 };
0210 
0211 
0212 /**
0213  * Base class of items in TreeMap.
0214  *
0215  * This class supports an arbitrary number of text() strings
0216  * positioned counterclock-wise starting at TopLeft. Each item
0217  * has its own static value(), sum() and sorting(). The
0218  * splitMode() and borderWidth() is taken from a TreeMapWidget.
0219  *
0220  * If you want more flexibility, reimplement TreeMapItem and
0221  * override the corresponding methods. For dynamic creation of child
0222  * items on demand, reimplement children().
0223  */
0224 class TreeMapItem: public StoredDrawParams
0225 {
0226 public:
0227 
0228     /**
0229      * Split direction for nested areas:
0230      *  AlwaysBest: Choose split direction for every subitem according to
0231      *              longest side of rectangle left for drawing
0232      *  Best:       Choose split direction for all subitems of an area
0233      *              depending on longest side
0234      *  HAlternate: Horizontal at top;  alternate direction on depth step
0235      *  VAlternate: Vertical at top; alternate direction on depth step
0236      *  Horizontal: Always horizontal split direction
0237      *  Vertical:   Always vertical split direction
0238      */
0239     enum SplitMode { Bisection, Columns, Rows,
0240                      AlwaysBest, Best,
0241                      HAlternate, VAlternate,
0242                      Horizontal, Vertical };
0243 
0244     explicit TreeMapItem(TreeMapItem* parent = nullptr, double value = 1.0 );
0245     TreeMapItem(TreeMapItem* parent, double value,
0246                 const QString& text1, const QString& text2 = QString(),
0247                 const QString& text3 = QString(), const QString& text4 = QString());
0248     ~TreeMapItem() override;
0249 
0250     bool isChildOf(TreeMapItem*);
0251 
0252     TreeMapItem* commonParent(TreeMapItem* item);
0253 
0254     // force a redraw of this item
0255     void redraw();
0256 
0257     // delete all children
0258     void clear();
0259 
0260     // force new child generation & refresh
0261     void refresh();
0262 
0263     // call in a reimplemented items() method to check if already called
0264     // after a clear(), this will return false
0265     bool initialized();
0266 
0267     /**
0268      * Adds an item to a parent.
0269      * When no sorting is used, the item is appended (drawn at bottom).
0270      * This is only needed if the parent was not already specified in the
0271      * construction of the item.
0272      */
0273     void addItem(TreeMapItem*);
0274 
0275     /**
0276      * Returns a list of text strings of specified text number,
0277      * from root up to this item.
0278      */
0279     QStringList path(int) const;
0280 
0281     /**
0282      * Depth of this item. This is the distance to root.
0283      */
0284     int depth() const;
0285 
0286     /**
0287      * Parent Item
0288      */
0289     TreeMapItem* parent() const { return _parent; }
0290 
0291     /**
0292      * Temporary rectangle used for drawing this item the last time.
0293      * This is internally used to map from a point to an item.
0294      */
0295     void setItemRect(const QRect& r) { _rect = r; }
0296     void clearItemRect();
0297     const QRect& itemRect() const { return _rect; }
0298     int width() const { return _rect.width(); }
0299     int height() const { return _rect.height(); }
0300 
0301     /**
0302      * Temporary rectangle list of free space of this item.
0303      * Used internally to enable tooltip.
0304      */
0305     void clearFreeRects();
0306     const QList<QRect>& freeRects() const { return _freeRects; }
0307     void addFreeRect(const QRect& r);
0308 
0309     /**
0310      * Temporary child item index of the child that was current() recently.
0311      */
0312     int index() const { return _index; }
0313     void setIndex(int i) { _index = i; }
0314 
0315 
0316     /**
0317      * TreeMap widget this item is put in.
0318      */
0319     TreeMapWidget* widget() const { return _widget; }
0320 
0321     void setParent(TreeMapItem* p);
0322     void setWidget(TreeMapWidget* w) { _widget = w; }
0323     void setSum(double s) { _sum = s; }
0324     void setValue(double s) { _value = s; }
0325 
0326     virtual double sum() const;
0327     virtual double value() const;
0328     // replace "Default" position with setting from TreeMapWidget
0329     Position position(int) const override;
0330     const QFont& font() const override;
0331     virtual bool isMarked(int) const;
0332 
0333     virtual int borderWidth() const;
0334 
0335     /**
0336      * Returns the text number after that sorting is done or
0337      * -1 for no sorting, -2 for value() sorting (default).
0338      * If ascending != 0, a bool value is written at that location
0339      * to indicate if sorting should be ascending.
0340      */
0341     virtual int sorting(bool* ascending) const;
0342 
0343     /**
0344      * Set the sorting for child drawing.
0345      *
0346      * Default is no sorting: @p textNo = -1
0347      * For value() sorting, use @p textNo = -2
0348      *
0349      * For fast sorting, set this to -1 before child insertions and call
0350      * again after inserting all children.
0351      */
0352     void setSorting(int textNo, bool ascending = true, bool recursive = false);
0353 
0354     /**
0355      * Resort according to the already set sorting.
0356      *
0357      * This has to be done if the sorting base changes (e.g. text or values
0358      * change). If this is only true for the children of this item, you can
0359      * set the recursive parameter to false.
0360      */
0361     void resort(bool recursive = true);
0362 
0363     virtual SplitMode splitMode() const;
0364     virtual int rtti() const;
0365     // not const as this can create children on demand
0366     virtual TreeMapItemList* children();
0367 
0368 protected:
0369     TreeMapItemList* _children;
0370     double _sum, _value;
0371 
0372 private:
0373     TreeMapWidget* _widget;
0374     TreeMapItem* _parent;
0375 
0376     int _sortTextNo;
0377     bool _sortAscending;
0378 
0379     // temporary layout
0380     QRect _rect;
0381     QList<QRect> _freeRects;
0382     int _depth;
0383 
0384     // temporary self value (when using level skipping)
0385     double _unused_self;
0386 
0387     // index of last active subitem
0388     int _index;
0389 };
0390 
0391 
0392 /**
0393  * Class for visualization of a metric of hierarchically
0394  * nested items as 2D areas.
0395  */
0396 class TreeMapWidget: public QWidget
0397 {
0398     Q_OBJECT
0399 
0400 public:
0401 
0402     /**
0403      * Same as in QListBox/QListView
0404      */
0405     enum SelectionMode { Single, Multi, Extended, NoSelection };
0406 
0407     /* The widget gets owner of the base item */
0408     explicit TreeMapWidget(TreeMapItem* base, QWidget* parent=nullptr);
0409     ~TreeMapWidget() override;
0410 
0411     /**
0412      * Returns the TreeMapItem filling out the widget space
0413      */
0414     TreeMapItem* base() const { return _base; }
0415 
0416     /**
0417      * Returns a reference to the current widget font.
0418      */
0419     const QFont& currentFont() const;
0420 
0421     /**
0422      * Returns the area item at position x/y, independent from any
0423      * maxSelectDepth setting.
0424      */
0425     TreeMapItem* item(int x, int y) const;
0426 
0427     /**
0428      * Returns the nearest item with a visible area; this
0429      * can be the given item itself.
0430      */
0431     TreeMapItem* visibleItem(TreeMapItem*) const;
0432 
0433     /**
0434      * Returns the item possible for selection. this returns the
0435      * given item itself or a parent thereof,
0436      * depending on setting of maxSelectDepth().
0437      */
0438     TreeMapItem* possibleSelection(TreeMapItem*) const;
0439 
0440     /**
0441      * Selects or unselects an item.
0442      * In multiselection mode, the constrain that a selected item
0443      * has no selected children or parents stays true.
0444      */
0445     void setSelected(TreeMapItem*, bool selected = true);
0446 
0447     /**
0448      * Switches on the marking @p markNo. Marking 0 switches off marking.
0449      * This is mutually exclusive to selection, and is automatically
0450      * switched off when selection is changed (also by the user).
0451      * Marking is visually the same as selection, and is based on
0452      * TreeMapItem::isMarked(@c markNo).
0453      * This enables to programmatically show multiple selected items
0454      * at once even in single selection mode.
0455      */
0456     void setMarked(int markNo = 1, bool redraw = true);
0457 
0458     /**
0459      * Clear selection of all selected items which are children of
0460      * parent. When parent == 0, clears whole selection
0461      * Returns true if selection changed.
0462      */
0463     bool clearSelection(TreeMapItem* parent = nullptr);
0464 
0465     /**
0466      * Selects or unselects items in a range.
0467      * This is needed internally for Shift-Click in Extended mode.
0468      * Range means for a hierarchical widget:
0469      * - select/unselect i1 and i2 according selected
0470      * - search common parent of i1 and i2, and select/unselect the
0471      *   range of direct children between but excluding the child
0472      *   leading to i1 and the child leading to i2.
0473      */
0474     void setRangeSelection(TreeMapItem* i1,
0475                            TreeMapItem* i2, bool selected);
0476 
0477     /**
0478      * Sets the current item.
0479      * The current item is mainly used for keyboard navigation.
0480      */
0481     void setCurrent(TreeMapItem*, bool kbd=false);
0482 
0483     /**
0484      * Set the maximal depth a selected item can have.
0485      * If you try to select a item with higher depth, the ancestor holding
0486      * this condition is used.
0487      *
0488      * See also possibleSelection().
0489      */
0490     void setMaxSelectDepth(int d) { _maxSelectDepth = d; }
0491 
0492 
0493     void setSelectionMode(SelectionMode m) { _selectionMode = m; }
0494 
0495     /**
0496      * for setting/getting global split direction
0497      */
0498     void setSplitMode(TreeMapItem::SplitMode m);
0499     TreeMapItem::SplitMode splitMode() const;
0500     // returns true if string was recognized
0501     bool setSplitMode(const QString&);
0502     QString splitModeString() const;
0503 
0504 
0505     /*
0506    * Shading of rectangles enabled ?
0507    */
0508     void setShadingEnabled(bool s);
0509     bool isShadingEnabled() const { return _shading; }
0510 
0511     /* Setting for a whole depth level: draw 3D frame (default) or solid */
0512     void drawFrame(int d, bool b);
0513     bool drawFrame(int d) const { return (d<4)?_drawFrame[d]:true; }
0514 
0515     /* Setting for a whole depth level: draw items (default) or transparent */
0516     void setTransparent(int d, bool b);
0517     bool isTransparent(int d) const { return (d<4)?_transparent[d]:false; }
0518 
0519     /**
0520      * Items usually have a size proportional to their value().
0521      * With @p width, you can give the minimum width
0522      * of the resulting rectangle to still be drawn.
0523      * For space not used because of to small items, you can specify
0524      * with @p reuseSpace if the background should shine through or
0525      * the space will be used to enlarge the next item to be drawn
0526      * at this level.
0527      */
0528     void setVisibleWidth(int width, bool reuseSpace = false);
0529 
0530     /**
0531      * If a children value() is almost the parents sum(),
0532      * it can happen that the border to be drawn for visibility of
0533      * nesting relations takes to much space, and the
0534      * parent/child size relation can not be mapped to a correct
0535      * area size relation.
0536      *
0537      * Either
0538      * (1) Ignore the incorrect drawing, or
0539      * (2) Skip drawing of the parent level altogether.
0540      */
0541     void setSkipIncorrectBorder(bool enable = true);
0542     bool skipIncorrectBorder() const { return _skipIncorrectBorder; }
0543 
0544     /**
0545      * Maximal nesting depth
0546      */
0547     void setMaxDrawingDepth(int d);
0548     int maxDrawingDepth() const { return _maxDrawingDepth; }
0549 
0550     /**
0551      * Minimal area for rectangles to draw
0552      */
0553     void setMinimalArea(int area);
0554     int minimalArea() const { return _minimalArea; }
0555 
0556     /* defaults for text attributes */
0557     QString defaultFieldType(int) const;
0558     QString defaultFieldStop(int) const;
0559     bool    defaultFieldVisible(int) const;
0560     bool    defaultFieldForced(int) const;
0561     DrawParams::Position defaultFieldPosition(int) const;
0562 
0563     /**
0564      * Set the type name of a field.
0565      * This is important for the visualization menu generated
0566      * with visualizationMenu()
0567      */
0568     void setFieldType(int, const QString&);
0569     QString fieldType(int) const;
0570 
0571     /**
0572      * Stop drawing at item with name
0573      */
0574     void setFieldStop(int, const QString&);
0575     QString fieldStop(int) const;
0576 
0577     /**
0578      * Should the text with number textNo be visible?
0579      * This is only done if remaining space is enough to allow for
0580      * proportional size constrains.
0581      */
0582     void setFieldVisible(int, bool);
0583     bool fieldVisible(int) const;
0584 
0585     /**
0586      * Should the drawing of the name into the rectangle be forced?
0587      * This enables drawing of the name before drawing subitems, and
0588      * thus destroys proportional constrains.
0589      */
0590     void setFieldForced(int, bool);
0591     bool fieldForced(int) const;
0592 
0593     /**
0594      * Set the field position in the area. See TreeMapItem::Position
0595      */
0596     void setFieldPosition(int, DrawParams::Position);
0597     DrawParams::Position fieldPosition(int) const;
0598     void setFieldPosition(int, const QString&);
0599     QString fieldPositionString(int) const;
0600 
0601     /**
0602      * Do we allow the texts to be rotated by 90 degrees for better fitting?
0603      */
0604     void setAllowRotation(bool);
0605     bool allowRotation() const { return _allowRotation; }
0606 
0607     void setBorderWidth(int w);
0608     int borderWidth() const { return _borderWidth; }
0609 
0610     /**
0611      * Populate given menu with option items.
0612      * The added items are automatically connected to handlers.
0613      */
0614     void addSplitDirectionItems(QMenu*);
0615 
0616     TreeMapWidget* widget() { return this; }
0617     TreeMapItem* current() const { return _current; }
0618     TreeMapItemList selection() const { return _selection; }
0619     bool isSelected(TreeMapItem* i) const;
0620     int maxSelectDepth() const { return _maxSelectDepth; }
0621     SelectionMode selectionMode() const { return _selectionMode; }
0622 
0623     /**
0624      * Return tooltip string to show for a item (can be rich text)
0625      * Default implementation gives lines with "text0 (text1)" going to root.
0626      */
0627     virtual QString tipString(TreeMapItem* i) const;
0628 
0629     /**
0630      * Redraws an item with all children.
0631      * This takes changed values(), sums(), colors() and text() into account.
0632      */
0633     void redraw(TreeMapItem*);
0634     void redraw() { redraw(_base); }
0635 
0636     /**
0637      * Resort all TreeMapItems. See TreeMapItem::resort().
0638      */
0639     void resort() { _base->resort(true); }
0640 
0641     // internal
0642     void drawTreeMap();
0643 
0644     // used internally when items are destroyed
0645     void deletingItem(TreeMapItem*);
0646 
0647 protected Q_SLOTS:
0648     void splitActivated(QAction*);
0649 
0650 Q_SIGNALS:
0651     void selectionChanged();
0652     void selectionChanged(TreeMapItem*);
0653 
0654     /**
0655      * This signal is emitted if the current item changes.
0656      * If the change is done because of keyboard navigation,
0657      * the @p keyboard is set to true
0658      */
0659     void currentChanged(TreeMapItem*, bool keyboard);
0660     void clicked(TreeMapItem*);
0661     void returnPressed(TreeMapItem*);
0662     void doubleClicked(TreeMapItem*);
0663     void rightButtonPressed(TreeMapItem*, const QPoint &);
0664     void contextMenuRequested(TreeMapItem*, const QPoint &);
0665 
0666 protected:
0667     void mousePressEvent( QMouseEvent * ) override;
0668     void contextMenuEvent( QContextMenuEvent * ) override;
0669     void mouseReleaseEvent( QMouseEvent * ) override;
0670     void mouseMoveEvent( QMouseEvent * ) override;
0671     void mouseDoubleClickEvent( QMouseEvent * ) override;
0672     void keyPressEvent( QKeyEvent* ) override;
0673     void paintEvent( QPaintEvent * ) override;
0674     void fontChange( const QFont& );
0675     bool event(QEvent *event) override;
0676 
0677 private:
0678     TreeMapItemList diff(TreeMapItemList&, TreeMapItemList&);
0679     // returns true if selection changed
0680     TreeMapItem* setTmpSelected(TreeMapItem*, bool selected = true);
0681     TreeMapItem* setTmpRangeSelection(TreeMapItem* i1,
0682                                       TreeMapItem* i2, bool selected);
0683     bool isTmpSelected(TreeMapItem* i);
0684 
0685     void drawItem(QPainter* p, TreeMapItem*);
0686     void drawItems(QPainter* p, TreeMapItem*);
0687     bool horizontal(TreeMapItem* i, const QRect& r);
0688     void drawFill(TreeMapItem*,QPainter* p, const QRect& r);
0689     void drawFill(TreeMapItem*,QPainter* p, const QRect& r,
0690                   TreeMapItemList* list, int idx, int len, bool goBack);
0691     bool drawItemArray(QPainter* p, TreeMapItem*, const QRect& r, double,
0692                        TreeMapItemList* list, int idx, int len, bool);
0693     bool resizeAttr(int);
0694 
0695     void addSplitAction(QMenu*, const QString&, int);
0696 
0697     TreeMapItem* _base;
0698     TreeMapItem *_current, *_pressed, *_lastOver, *_oldCurrent;
0699     int _maxSelectDepth, _maxDrawingDepth;
0700 
0701     // attributes for field, per textNo
0702     struct FieldAttr {
0703         QString type, stop;
0704         bool visible, forced;
0705         DrawParams::Position pos;
0706     };
0707     QVector<FieldAttr> _attr;
0708 
0709     SelectionMode _selectionMode;
0710     TreeMapItem::SplitMode _splitMode;
0711     int _visibleWidth, _stopArea, _minimalArea, _borderWidth;
0712     bool _reuseSpace, _skipIncorrectBorder, _drawSeparators, _shading;
0713     bool _allowRotation;
0714     bool _transparent[4], _drawFrame[4];
0715     TreeMapItem * _needsRefresh;
0716     TreeMapItemList _selection;
0717     int _markNo;
0718 
0719     // temporary selection while dragging, used for drawing
0720     // most of the time, _selection == _tmpSelection
0721     TreeMapItemList _tmpSelection;
0722     bool _inShiftDrag, _inControlDrag;
0723 
0724     // temporary widget font metrics while drawing
0725     QFont _font;
0726     int _fontHeight;
0727 
0728     // back buffer pixmap
0729     QPixmap _pixmap;
0730 };
0731 
0732 #endif