summaryrefslogtreecommitdiffstats
path: root/profile-widget/divetooltipitem.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-03 12:46:56 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-03 13:56:05 -0800
commitb188560ae57304676fb10d8015dc2e3985e44c42 (patch)
tree81bd406f2de74d186c1113eb0634f1a38ba6f85f /profile-widget/divetooltipitem.cpp
parent9759d5b21a330ae2908fe91ff1533d06f6a59f4f (diff)
downloadsubsurface-b188560ae57304676fb10d8015dc2e3985e44c42.tar.gz
ui: create a RoundRectItem class
Factor out code from ProfileWidget's ToolTipItem, but make the radius of the corners dynamic. Move into backend-shared, though a new ui-shared might be preferred. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget/divetooltipitem.cpp')
-rw-r--r--profile-widget/divetooltipitem.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/profile-widget/divetooltipitem.cpp b/profile-widget/divetooltipitem.cpp
index 908f40070..f62a68ad8 100644
--- a/profile-widget/divetooltipitem.cpp
+++ b/profile-widget/divetooltipitem.cpp
@@ -7,7 +7,6 @@
#include "core/settings/qPrefDisplay.h"
#include <QPropertyAnimation>
#include <QGraphicsView>
-#include <QStyleOptionGraphicsItem>
#include "core/qthelper.h"
void ToolTipItem::addToolTip(const QString &toolTip, const QIcon &icon, const QPixmap& pixmap)
@@ -133,7 +132,7 @@ void ToolTipItem::expand()
status = EXPANDED;
}
-ToolTipItem::ToolTipItem(QGraphicsItem *parent) : QGraphicsRectItem(parent),
+ToolTipItem::ToolTipItem(QGraphicsItem *parent) : RoundRectItem(parent),
title(new QGraphicsSimpleTextItem(tr("Information"), this)),
status(COLLAPSED),
timeAxis(0),
@@ -194,16 +193,6 @@ void ToolTipItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
}
-void ToolTipItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget*)
-{
- painter->save();
- painter->setClipRect(option->rect);
- painter->setPen(pen());
- painter->setBrush(brush());
- painter->drawRoundedRect(rect(), 8, 8, Qt::AbsoluteSize);
- painter->restore();
-}
-
void ToolTipItem::persistPos()
{
qPrefDisplay::set_tooltip_position(pos());