Skip to content

Commit

Permalink
Merge pull request #356 from silicon-heaven/show-tooltip-on-graph-header
Browse files Browse the repository at this point in the history
show tooltip on graph header
  • Loading branch information
fvacek authored Oct 6, 2023
2 parents 67c778a + 7fad670 commit a430d1e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion libshvvisu/src/timeline/graphwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <QMimeData>
#include <cmath>
#include <QMessageBox>
#include <QToolTip>

#define logMouseSelection() nCDebug("MouseSelection")

Expand Down Expand Up @@ -92,8 +93,23 @@ void GraphWidget::makeLayout()

bool GraphWidget::event(QEvent *ev)
{
if(Graph *gr = graph())
if(Graph *gr = graph()) {
gr->processEvent(ev);
if (ev->type() == QEvent::ToolTip) {
auto *help_event = static_cast<QHelpEvent *>(ev);

auto channel_ix = gr->posToChannelHeader(help_event->pos());

if (channel_ix > -1) {
const GraphChannel *ch = gr->channelAt(channel_ix);
QToolTip::showText(help_event->globalPos(), ch->shvPath(), this, {}, 2000);
help_event->accept();
return true;
}
QToolTip::hideText();
help_event->ignore();
}
}
return Super::event(ev);
}

Expand Down

0 comments on commit a430d1e

Please sign in to comment.