Strange problem of the QgsApplication class instead of the QApplication

  • Now I develop an application that based on the "Quantum GIS": libraries. I begin with very simple program:

    @// QGIS Includes
    #include <qgsapplication.h>
    #include <qgsproviderregistry.h>
    #include <qgssinglesymbolrenderer.h>
    #include <qgsmaplayerregistry.h>
    #include <qgsvectorlayer.h>
    #include <qgsmapcanvas.h>
    // Qt Includes
    #include <QString>
    #include <QApplication>
    #include <QWidget>

    int main(int argc, char *argv[])
    QgsApplication app(argc, argv, true);
    return app.exec();
    Okay, when I build this console application and start it under command line of the Quantum GIS shell ("OSGeo4W":, it fails with a strange message "QApplication::exec: Please instantiate the QApplication object first"; if I exchange a "QgsApplication": to a QApplication class, the program start without an error. But the QgsApplication is a child of a QApplication class, as described in the Quantum GIS documentation. What's wrong, I'm confused!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.