void MapWindow::paintGL() { m_frameDraws++; m_map.resize(size(), size() * pixelRatio()); #if QT_VERSION < 0x050400 && defined(__APPLE__) // XXX GL framebuffer is valid only after first attempt of painting on // older versions of Qt on macOS. // See https://bugreports.qt.io/browse/QTBUG-36802 for details. static bool first = true; if (!first) m_map.render(); first = false; #else m_map.render(); #endif }
MapWindow::MapWindow(const QMapboxGLSettings &settings) : m_map(nullptr, settings, size(), pixelRatio()) , m_bearingAnimation(&m_map, "bearing") , m_zoomAnimation(&m_map, "zoom") { connect(&m_map, SIGNAL(needsRendering()), this, SLOT(updateGL())); // Set default location to Helsinki. m_map.setCoordinateZoom(QMapbox::Coordinate(60.170448, 24.942046), 14); QString styleUrl = qgetenv("MAPBOX_STYLE_URL"); if (styleUrl.isEmpty()) { changeStyle(); } else { m_map.setStyleUrl(styleUrl); setWindowTitle(QString("Mapbox GL: ") + styleUrl); } connect(&m_zoomAnimation, SIGNAL(finished()), this, SLOT(animationFinished())); connect(&m_zoomAnimation, SIGNAL(valueChanged(const QVariant&)), this, SLOT(animationValueChanged())); setWindowIcon(QIcon(":icon.png")); }
void MapWindow::initializeGL() { QMapbox::initializeGLExtensions(); m_map.reset(new QMapboxGL(nullptr, m_settings, size(), pixelRatio())); connect(m_map.data(), SIGNAL(needsRendering()), this, SLOT(update())); // Set default location to Helsinki. m_map->setCoordinateZoom(QMapbox::Coordinate(60.170448, 24.942046), 14); QString styleUrl = qgetenv("MAPBOX_STYLE_URL"); if (styleUrl.isEmpty()) { changeStyle(); } else { m_map->setStyleUrl(styleUrl); setWindowTitle(QString("Mapbox GL: ") + styleUrl); } m_bearingAnimation = new QPropertyAnimation(m_map.data(), "bearing"); m_zoomAnimation = new QPropertyAnimation(m_map.data(), "zoom"); connect(m_zoomAnimation, SIGNAL(finished()), this, SLOT(animationFinished())); connect(m_zoomAnimation, SIGNAL(valueChanged(const QVariant&)), this, SLOT(animationValueChanged())); }
void MapWindow::paintGL() { m_frameDraws++; m_map->resize(size(), size() * pixelRatio()); m_map->render(); }