c++qtpointersqt-mobility

Allocating memory to a pointer of a class


QGeoRoutingManager: http://apidocs.meego.com/1.0/qtmobility/qgeoroutingmanager-members.html

This class doesn't have a constructor. I have forgotten the way to allocate memory to its pointer.

I did:

QGeoRoutingManager *a = new QGeoRoutingManager ();

This lands in the error:

calculateRoute.cpp:16: error: no matching function for call to ‘QtMobility::QGeoRoutingManager::QGeoRoutingManager()’
../../../../tarBalls/qt-mobility-opensource-src-1.2.0/install/include/QtLocation/qgeoroutingmanager.h:91: note: candidates are: QtMobility::QGeoRoutingManager::QGeoRoutingManager(const QtMobility::QGeoRoutingManager&)

What should I pass in there, as per the error message "const QtMobility::QGeoRoutingManager&"


Solution

  • This is a singleton class, you can access it like this:

    QGeoServiceProvider::routingManager().
    

    Check the docs