Inherit from QGraphicsRectItem instead of QGraphicsShapeItem

a rectangle is *much* faster to paint than a simple ShapeItem,
so this is a safer choice. We still need to create the paint
method so we can use the correct roundness for the rectangle.
Currently it's white with a 1px solid line - terrible. :)

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-16 16:01:54 -02:00 committed by Dirk Hohndel
parent d8830ad31c
commit deafa40d34
2 changed files with 12 additions and 19 deletions

View file

@ -1,7 +1,7 @@
#ifndef DIVETOOLTIPITEM_H
#define DIVETOOLTIPITEM_H
#include <QGraphicsPathItem>
#include <QGraphicsRectItem>
#include <QVector>
#include <QPair>
#include <QRectF>
@ -17,10 +17,10 @@ struct graphics_context;
/* To use a tooltip, simply ->setToolTip on the QGraphicsItem that you want
* or, if it's a "global" tooltip, set it on the mouseMoveEvent of the ProfileGraphicsView.
*/
class ToolTipItem : public QObject, public QGraphicsPathItem {
class ToolTipItem : public QObject, public QGraphicsRectItem {
Q_OBJECT
void updateTitlePosition();
Q_PROPERTY(QRectF rect READ boundingRect WRITE setRect)
Q_PROPERTY(QRectF rect READ rect WRITE setRect)
public:
enum Status {