user7431005
user7431005

Reputation: 4539

qt QScatterSeries clicked signal is emitted to ChartView mousePressEvent

I have a custom implementation of QChartView where I can zoom. (Class "ChartView" from this example) In there I have a mousePressEvent.

Now I wanted to add a QScatterSeries and connect the clicked signal with a custom slot. Unfortunately as soon as I click on my QScatterSeries only a signal is emitted to my ChartView mousePressEvent slot and not to my QScatterSeries mypoint_clicked slot.

I also added an QScatterSeries hovered signal which works fine.

connect(myScatterSeries, SIGNAL(hovered(QPointF,bool)), this, SLOT(mypoint_hovered(QPointF,bool)));
connect(myScatterSeries, SIGNAL(clicked(QPointF)), this, SLOT(mypoint_clicked(QPointF)));

Upvotes: 0

Views: 807

Answers (1)

Benjamin T
Benjamin T

Reputation: 8311

Just guessing here.

mousePressEvent() is not a slot, but an event handler. I guess that QChartView::mousePressEvent() is somewhat responsible for handling mouse press events on the chart and dispatching them to series.

If you reimplemented ChartView::mousePressEvent() without explicitly calling QChartView::mousePressEvent() to forward the event, you might prevent the normal event processing to dispatch the event to the series. And therefore QScatterSeries::clicked() is never emitted.

Upvotes: 1

Related Questions