ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  class QWheelEvent’ has no member named ‘delta’
Posted by Dave on May-19-2022 02:30
Reviving an old app using ChartDirector, , this time under QT 6.2 Qt Creator 7.0.1, and ger error

/home/david/AA Development/AlgoTrade/ibV5 RT Test Running/ChartDirector/qchartviewer.cpp:274: error: ‘class QWheelEvent’ has no member named ‘delta’
../ibV5 RT Test Running/ChartDirector/qchartviewer.cpp: In member function ‘virtual void QChartViewer::wheelEvent(QWheelEvent*)’:
../ibV5 RT Test Running/ChartDirector/qchartviewer.cpp:274:75: error: ‘class QWheelEvent’ has no member named ‘delta’
  274 |         onMouseWheelZoom(getPlotAreaMouseX(), getPlotAreaMouseY(), event->delta());
      |                                                                           ^~~~~
also for members x and y

Thanks for the help

  Re: class QWheelEvent’ has no member named ‘delta’
Posted by Peter Kwan on May-19-2022 17:14
Hi Dave,

In Qt 4.x or earlier, there is a QWheelEvent::delta. In Qt 5.x or later, there is no such method, but there is a QWheelEvent::angleDelta. (Qt is not backwards compatible with itself across major versions.)

You are probably using an old ChartDirector version that was released before Qt 5.x. We suggest you upgrade to the latest version of ChartDirector for C++, which supports Qt 5.x and and later versions.

Alternatively, you can try to change the "delta()" to "angleDelta()" to see if it works.

Regards
Peter Kwan

  Re: class QWheelEvent’ has no member named ‘delta’
Posted by Dave on May-19-2022 19:28
I upgraded but realized I had my own extension to trackfinance.cpp

For the time being commented the code and its compiling, but would like to have the wheel functionality.

Thanks!


The culprit is in this code:

qchartviewer.cpp:1734:55: No member named 'x' in 'QWheelEvent'

qchartviewer.cpp:1734:67: No member named 'y' in 'QWheelEvent'

and

qchartviewer.cpp:1742:52: No viable conversion from 'QPoint' to 'int'
qchartviewer.cpp:280:55: passing argument to parameter 'zDelta' here



void QViewPortControl::wheelEvent(QWheelEvent *event)
{
    // Process the mouse wheel only if the mouse is over the plot area
    if ((0 == m_ChartViewer) || (!isOnPlotArea(event->x(), event->y())))
        event->ignore();
    else
    {
        // Ask the CChartViewer to zoom around the center of the chart
        int x = m_ChartViewer->getPlotAreaLeft() + m_ChartViewer->getPlotAreaWidth() / 2;
        int y = m_ChartViewer->getPlotAreaTop() + m_ChartViewer->getPlotAreaHeight() / 2;
        // DBGif (!m_ChartViewer->onMouseWheelZoom(x, y, event->delta()))
        if (!m_ChartViewer->onMouseWheelZoom(x, y, event->angleDelta()))
            event->ignore();
    }
}

  Re: class QWheelEvent’ has no member named ‘delta’
Posted by Peter Kwan on May-19-2022 20:27
Hi Dave,

Sorry for the mistake. The "delta()" should be replaced with "angleDelta().y()". The "x()" and "y()" should be replaced with "position().x()" and "position().y()".

There can be other changes between Qt4 and Qt6. So I still think it is better to upgrade to the latest version of ChartDirector.

For the trackfinance.cpp (or FinanceChart.cpp), it is a sample code included in ChartDirector. Even if you modify or extend it, it should continue to run on the latest version of ChartDirector.

In general, the ChartDirector API is very backwards compatible. Your code should continue to run in an upgrade version of ChartDirector. On the other hand, Qt is not backwards compatible. If you upgrade Qt, some code changes may be necessary. We have already implement the necessary code changes in ChartDirector, so your own charting code should continue to work.

Regards
Peter Kwan

  Re: class QWheelEvent’ has no member named ‘delta’
Posted by Dave on May-23-2022 19:47
Thanks!! I'll replace to newest version later in the week.