Remove the background and the separator

Those items were used to fake the background of the path item
but since the rectangle can be painted with a border and a
fill, this is uneeded.

The rect is still ugly.

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:06:14 -02:00 committed by Dirk Hohndel
parent deafa40d34
commit 48a23b9b3c
2 changed files with 2 additions and 25 deletions

View file

@ -62,10 +62,6 @@ void ToolTipItem::setRect(const QRectF &r)
} }
QGraphicsRectItem::setRect(r); QGraphicsRectItem::setRect(r);
QPainterPath bg;
bg.addRoundedRect(-1, -1, rect().width() + 3, rect().height() + 4, 3, 3);
background->setPath(bg);
updateTitlePosition(); updateTitlePosition();
} }
@ -127,8 +123,6 @@ void ToolTipItem::expand()
} }
ToolTipItem::ToolTipItem(QGraphicsItem *parent) : QGraphicsRectItem(parent), ToolTipItem::ToolTipItem(QGraphicsItem *parent) : QGraphicsRectItem(parent),
background(0),
separator(new QGraphicsLineItem(this)),
title(new QGraphicsSimpleTextItem(tr("Information"), this)), title(new QGraphicsSimpleTextItem(tr("Information"), this)),
status(COLLAPSED), status(COLLAPSED),
timeAxis(0), timeAxis(0),
@ -141,23 +135,15 @@ ToolTipItem::ToolTipItem(QGraphicsItem *parent) : QGraphicsRectItem(parent),
QColor c = QColor(Qt::black); QColor c = QColor(Qt::black);
c.setAlpha(155); c.setAlpha(155);
background = new QGraphicsPathItem(this); setBrush(c);
background->setFlag(ItemStacksBehindParent); setPen(QPen(QBrush(Qt::transparent), 0));
background->setFlag(ItemIgnoresTransformations);
background->setBrush(c);
background->setPen(QPen(QBrush(Qt::transparent), 0));
background->setZValue(-10);
updateTitlePosition();
setZValue(99); setZValue(99);
addToolTip(QString(), QIcon(), QPixmap(16,60)); addToolTip(QString(), QIcon(), QPixmap(16,60));
entryToolTip = toolTips.first(); entryToolTip = toolTips.first();
toolTips.clear(); toolTips.clear();
separator->setFlag(ItemIgnoresTransformations);
separator->setPen(QPen(Qt::white));
title->setFlag(ItemIgnoresTransformations); title->setFlag(ItemIgnoresTransformations);
title->setPen(QPen(Qt::white, 1)); title->setPen(QPen(Qt::white, 1));
title->setBrush(Qt::white); title->setBrush(Qt::white);
@ -182,13 +168,6 @@ void ToolTipItem::updateTitlePosition()
} }
title->setPos(boundingRect().width() / 2 - title->boundingRect().width() / 2 - 1, 0); title->setPos(boundingRect().width() / 2 - title->boundingRect().width() / 2 - 1, 0);
double x1 = 3;
double y1 = title->pos().y() + iconMetrics.spacing / 2 + title->boundingRect().height();
double x2 = boundingRect().width() - 10;
double y2 = y1;
separator->setLine(x1, y1, x2, y2);
} }
bool ToolTipItem::isExpanded() const bool ToolTipItem::isExpanded() const

View file

@ -51,8 +51,6 @@ private:
typedef QPair<QGraphicsPixmapItem *, QGraphicsSimpleTextItem *> ToolTip; typedef QPair<QGraphicsPixmapItem *, QGraphicsSimpleTextItem *> ToolTip;
QVector<ToolTip> toolTips; QVector<ToolTip> toolTips;
ToolTip entryToolTip; ToolTip entryToolTip;
QGraphicsPathItem *background;
QGraphicsLineItem *separator;
QGraphicsSimpleTextItem *title; QGraphicsSimpleTextItem *title;
Status status; Status status;
QRectF rectangle; QRectF rectangle;