Hi,

I have found a solution. Could it been, that the view is reseted after loading the KML data and the data is loading as a own thread in the background?

If I add a delay of 1 second before calling show() the view is correct
zoomed and positioned.

Is there a possibilty to get a message, if the KML data is complete loaded?

#include <QtGui/QApplication>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
#include <marble/MarbleWidget.h>
#include <marble/GeoDataDocument.h>
#include <marble/GeoDataTreeModel.h>
#include <marble/MarbleModel.h>

using namespace Marble;

void delay()
{
    QTime dieTime= QTime::currentTime().addSecs(1);
    while( QTime::currentTime() < dieTime )
    QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
}

int main(int argc, char** argv)
{
    QApplication app(argc,argv);
    MarbleWidget *mapWidget = new MarbleWidget();

    mapWidget->resize(800,600);
    mapWidget->setWindowTitle("CQRLOG DXCC Map");
    mapWidget->setMapThemeId("earth/bluemarble/bluemarble.dgml");

mapWidget->model()->addGeoDataFile("/home/tom/projects/Qt/dxcc/dxcc.kml");

    delay();

    mapWidget->setZoom(1200);
GeoDataCoordinates position(8.545486,53.106076,0.0,GeoDataCoordinates::Degree);
    mapWidget->centerOn(position);

    mapWidget->show();
    return app.exec();
}

Thanks,
Tom
--
DARC OV I18|DL-QRP-AG #1186|G-QRP #14624|FISTS #15933|AGCW #2737|ARRL
http://dl7bj.org                            https://twitter.com/dl7bj
_______________________________________________
Marble-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/marble-devel

Reply via email to