mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Adapt the ToolTip to work on the new profile
With this patch the tooltip is ready to work on the new profile, we just need to actually use it. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
19585d9a13
commit
40cb57b202
5 changed files with 54 additions and 2 deletions
|
@ -1,4 +1,6 @@
|
|||
#include "divetooltipitem.h"
|
||||
#include "divecartesianaxis.h"
|
||||
#include "profile.h"
|
||||
#include <QPropertyAnimation>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QPen>
|
||||
|
@ -176,7 +178,7 @@ void ToolTipItem::updateTitlePosition()
|
|||
}
|
||||
}
|
||||
|
||||
bool ToolTipItem::isExpanded() {
|
||||
bool ToolTipItem::isExpanded() const {
|
||||
return status == EXPANDED;
|
||||
}
|
||||
|
||||
|
@ -207,3 +209,28 @@ void ToolTipItem::readPos()
|
|||
}
|
||||
setPos(value);
|
||||
}
|
||||
|
||||
void ToolTipItem::setPlotInfo(const plot_info& plot)
|
||||
{
|
||||
pInfo = plot;
|
||||
}
|
||||
|
||||
void ToolTipItem::setTimeAxis(DiveCartesianAxis* axis)
|
||||
{
|
||||
timeAxis = axis;
|
||||
}
|
||||
|
||||
void ToolTipItem::refresh(const QPointF& pos)
|
||||
{
|
||||
clear();
|
||||
int time = timeAxis->posAtValue( pos.x() );
|
||||
char buffer[500];
|
||||
get_plot_details_new(&pInfo, time, buffer, 500);
|
||||
addToolTip(QString(buffer));
|
||||
|
||||
QList<QGraphicsItem*> items = scene()->items(pos, Qt::IntersectsItemShape, Qt::DescendingOrder, transform());
|
||||
Q_FOREACH(QGraphicsItem *item, items) {
|
||||
if (!item->toolTip().isEmpty())
|
||||
addToolTip(item->toolTip());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue