Reuse the entry tooltip item and do fewer calls for each mouse move

While analizing the code for the mouse movement I've discovered that
we did a lot of uneeded things: Set the color, the pen, the size
of a fixed-colored line, twice.

We also deleted-newed the same Pixmap / Text for every mouse movement
so now we reuse the 'entryToolTip' that consists of a huge line and
a pixmap, and after that we add the other tooltips that are not static

Also, reduced a lot the number of calls to expand() (that did a lot of
math).

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-01-14 17:11:41 -02:00 committed by Dirk Hohndel
parent 3169ec8dc9
commit 6a1a6c82bf
2 changed files with 41 additions and 30 deletions

View file

@ -50,6 +50,7 @@ slots:
private:
typedef QPair<QGraphicsPixmapItem *, QGraphicsSimpleTextItem *> ToolTip;
QVector<ToolTip> toolTips;
ToolTip entryToolTip;
QGraphicsPathItem *background;
QGraphicsLineItem *separator;
QGraphicsSimpleTextItem *title;