profile: convert the "ruler item" to qt-quick

Code is mostly based on the "tooltip item". The dragging code was
slightly reworked to be more logical. A "disk item" was added for
the handles.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-01-12 22:26:32 +01:00
parent b167e130a4
commit ea0085fef6
14 changed files with 313 additions and 228 deletions

View file

@ -612,22 +612,37 @@ int ProfileScene::timeAt(QPointF pos) const
return lrint(timeAxis->valueAt(pos));
}
std::pair<double, double> ProfileScene::minMaxTime()
std::pair<double, double> ProfileScene::minMaxTime() const
{
return { timeAxis->minimum(), timeAxis->maximum() };
}
double ProfileScene::yToScreen(double y)
std::pair<double, double> ProfileScene::minMaxX() const
{
return timeAxis->screenMinMax();
}
std::pair<double, double> ProfileScene::minMaxY() const
{
return profileYAxis->screenMinMax();
}
double ProfileScene::yToScreen(double y) const
{
auto [min, max] = profileYAxis->screenMinMax();
return min + (max - min) * y;
}
double ProfileScene::posAtTime(double time)
double ProfileScene::posAtTime(double time) const
{
return timeAxis->posAtValue(time);
}
double ProfileScene::posAtDepth(double depth) const
{
return profileYAxis->posAtValue(depth);
}
std::vector<std::pair<QString, QPixmap>> ProfileScene::eventsAt(QPointF pos) const
{
std::vector<std::pair<QString, QPixmap>> res;