From f1466b2cd387e2892b79db110979a893f0a0954b Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Tue, 29 Aug 2017 12:00:09 +0200 Subject: Revert places_map.png to the pre-mapboxgl version The new screenshot did not match the code (showing Helsinki's pizzerias, not Oslo's) Change-Id: Ie51ca95c3e554e8a353d57e7a7db8f36521eef83 Reviewed-by: Alex Blasche --- .../location/places_map/doc/images/places_map.png | Bin 157761 -> 167995 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/examples/location/places_map/doc/images/places_map.png b/examples/location/places_map/doc/images/places_map.png index 72317e2d..4982df23 100644 Binary files a/examples/location/places_map/doc/images/places_map.png and b/examples/location/places_map/doc/images/places_map.png differ -- cgit v1.2.1 From 3856f0185442b5c4b85c770888072db0bc3fff1a Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Tue, 15 Aug 2017 13:21:48 +0200 Subject: Add a configure feature for each geoservice plugin This patch makes it possible to disable geoservice plugins at configuration time using the QtLite -no-feature-geoservices_xxx syntax. Change-Id: I276382833db8cfca27383705cbb3f994ced47cb3 Reviewed-by: Alex Blasche --- configure.json | 3 +- src/location/configure.json | 70 +++++++++++++++++++++++++++++++++ src/plugins/geoservices/geoservices.pro | 12 +++--- src/positioning/configure.json | 2 +- 4 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 src/location/configure.json diff --git a/configure.json b/configure.json index d54624af..379d8b4a 100644 --- a/configure.json +++ b/configure.json @@ -1,5 +1,6 @@ { "subconfigs": [ - "src/positioning" + "src/positioning", + "src/location" ] } diff --git a/src/location/configure.json b/src/location/configure.json new file mode 100644 index 00000000..4de6e865 --- /dev/null +++ b/src/location/configure.json @@ -0,0 +1,70 @@ +{ + "module": "location", + "depends": [ + "gui" + ], + + "features": { + "geoservices_osm": { + "label": "OpenStreetMap", + "purpose": "Provides access to OpenStreetMap geoservices", + "section": "Location", + "condition": "features.concurrent", + "output": [ "privateFeature" ] + }, + "geoservices_here": { + "label": "HERE", + "purpose": "Provides access to HERE geoservices", + "section": "Location", + "output": [ "privateFeature" ] + }, + "geoservices_esri": { + "label": "Esri", + "purpose": "Provides access to Esri geoservices", + "section": "Location", + "output": [ "privateFeature" ] + }, + "geoservices_mapbox": { + "label": "Mapbox", + "purpose": "Provides access to Mapbox geoservices", + "section": "Location", + "output": [ "privateFeature" ] + }, + "geoservices_mapboxgl": { + "label": "MapboxGL", + "purpose": "Provides access to the Mapbox vector maps", + "section": "Location", + "condition": [ + "features.opengl", + "features.c++14", + "!config.qnx && (!config.win32 || config.mingw)" + ], + "output": [ "privateFeature" ] + }, + "geoservices_itemsoverlay": { + "label": "Itemsoverlay", + "purpose": "Provides access to the itemsoverlay maps", + "section": "Location", + "output": [ "privateFeature" ] + } + }, + + "summary": [ + { + "section": "Qt Location", + "entries": [ + { + "section": "Geoservice plugins", + "entries": [ + "geoservices_osm", + "geoservices_here", + "geoservices_esri", + "geoservices_mapbox", + "geoservices_mapboxgl", + "geoservices_itemsoverlay" + ] + } + ] + } + ] +} diff --git a/src/plugins/geoservices/geoservices.pro b/src/plugins/geoservices/geoservices.pro index 07c34798..b81ad34a 100644 --- a/src/plugins/geoservices/geoservices.pro +++ b/src/plugins/geoservices/geoservices.pro @@ -1,12 +1,14 @@ TEMPLATE = subdirs -SUBDIRS = nokia mapbox esri itemsoverlay +QT_FOR_CONFIG += location-private # pulls in the features defined in configure.json -qtConfig(concurrent) { - SUBDIRS += osm -} +qtConfig(geoservices_here): SUBDIRS += nokia +qtConfig(geoservices_mapbox): SUBDIRS += mapbox +qtConfig(geoservices_esri): SUBDIRS += esri +qtConfig(geoservices_itemsoverlay): SUBDIRS += itemsoverlay +qtConfig(geoservices_osm): SUBDIRS += osm -qtConfig(opengl):qtConfig(c++14):!win32|mingw:!qnx { +qtConfig(geoservices_mapboxgl) { !exists(../../3rdparty/mapbox-gl-native/mapbox-gl-native.pro) { warning("Submodule mapbox-gl-native does not exist. Run 'git submodule update --init' on qtlocation.") } else { diff --git a/src/positioning/configure.json b/src/positioning/configure.json index 22b77be6..49e32be4 100644 --- a/src/positioning/configure.json +++ b/src/positioning/configure.json @@ -38,7 +38,7 @@ "summary": [ { - "section": "Qt Location", + "section": "Qt Positioning", "entries": [ "gypsy", "winrt_geolocation" -- cgit v1.2.1 From 7738ed4a18699d9d96f14dfe08dcc5ddfacf848f Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Wed, 30 Aug 2017 15:57:30 +0300 Subject: Fix broken native text rendering with Mapbox GL plugin Mapbox is "leaking" the pixel storage mode. So we need to restore it after we render otherwise it breaks native text rendering. Task-number: QTBUG-62861 Change-Id: I12643e34e462cce58cdf30da52ab927499f38442 Reviewed-by: Paolo Angelelli --- src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp b/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp index 3f31997c..82aa868f 100644 --- a/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp +++ b/src/plugins/geoservices/mapboxgl/qsgmapboxglnode.cpp @@ -88,10 +88,16 @@ void QSGMapboxGLTextureNode::render(QQuickWindow *window) QOpenGLFunctions *f = window->openglContext()->functions(); f->glViewport(0, 0, m_fbo->width(), m_fbo->height()); + GLint alignment; + f->glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); + m_fbo->bind(); m_map->render(); m_fbo->release(); + // QTBUG-62861 + f->glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); + window->resetOpenGLState(); markDirty(QSGNode::DirtyMaterial); } @@ -125,7 +131,13 @@ void QSGMapboxGLRenderNode::render(const RenderState *state) f->glScissor(state->scissorRect().x(), state->scissorRect().y(), state->scissorRect().width(), state->scissorRect().height()); f->glEnable(GL_SCISSOR_TEST); + GLint alignment; + f->glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); + m_map->render(); + + // QTBUG-62861 + f->glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); } QSGRenderNode::StateFlags QSGMapboxGLRenderNode::changedStates() const -- cgit v1.2.1 From 8dae4824df50dfde8c4910bdf88cde78aeb1ce18 Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Fri, 25 Aug 2017 12:31:51 +0300 Subject: Add change file for Qt 5.6.3 Change-Id: I76c7bb46ae7e068c1db780c34d8a0c065e55b2c4 Reviewed-by: Alex Blasche --- dist/changes-5.6.3 | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 dist/changes-5.6.3 diff --git a/dist/changes-5.6.3 b/dist/changes-5.6.3 new file mode 100644 index 00000000..4709ff2b --- /dev/null +++ b/dist/changes-5.6.3 @@ -0,0 +1,38 @@ +Qt 5.6.3 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.6.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + http://doc.qt.io/qt-5/index.html + +The Qt version 5.6 series is binary compatible with the 5.5.x series. +Applications compiled for 5.5 will continue to run with 5.6. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Library * +**************************************************************************** + +QtLocation +---------- + + - [QTBUG-56099] Updated HERE plugin base address + - [QTBUG-56119] Added OSRMv5 support to the osm plugin + - [QTBUG-57027] Fixed fitViewportToGeoShape on rectangles crossing the date + line. + - Updated HERE plugin geocoding endpoints + + +QtPositioning +------------- + + - [QTBUG-54844] Fixed error status for QGeoPositionInfoSourceAndroid + - [QTBUG-56623] WinRT backend now uses backend-provided timestamps -- cgit v1.2.1 From 6024168ef21dd4fe6c5ddd7e837d56076e886e01 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 28 Feb 2017 18:26:19 -0800 Subject: Mapbox GL native circle support Circles crossing one pole are drawn inverted. Circles crossing 2 poles do not even have the correct geometry. Nevertheless, a first approximation. Task-number: QTBUG-58869 Change-Id: I5a508f5d6e27c4f08412a7ae327883866068a1e9 Reviewed-by: Paolo Angelelli --- .../declarativemaps/qdeclarativecirclemapitem.cpp | 10 ++--- .../declarativemaps/qdeclarativecirclemapitem_p.h | 8 +++- .../geoservices/mapboxgl/qgeomapmapboxgl.cpp | 22 ++++++---- .../geoservices/mapboxgl/qmapboxglstylechange.cpp | 48 ++++++++++++++++++++++ .../geoservices/mapboxgl/qmapboxglstylechange_p.h | 1 + 5 files changed, 75 insertions(+), 14 deletions(-) diff --git a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp index 5f002bf9..91328dc7 100644 --- a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp +++ b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp @@ -262,7 +262,7 @@ void QGeoMapCircleGeometry::updateScreenPointsInvert(const QList &path, +void QDeclarativeCircleMapItem::calculatePeripheralPoints(QList &path, const QGeoCoordinate ¢er, qreal distance, int steps, @@ -644,9 +644,9 @@ void QDeclarativeCircleMapItem::updateCirclePathForRendering(QList &path, const QGeoCoordinate ¢er, + qreal distance, int steps, QGeoCoordinate &leftBound); + bool preserveCircleGeometry(QList &path, const QGeoCoordinate ¢er, + qreal distance); + Q_SIGNALS: void centerChanged(const QGeoCoordinate ¢er); void radiusChanged(qreal radius); @@ -111,8 +117,6 @@ protected Q_SLOTS: private: void updateCirclePath(); - bool preserveCircleGeometry(QList &path, const QGeoCoordinate ¢er, - qreal distance); void updateCirclePathForRendering(QList &path, const QGeoCoordinate ¢er, qreal distance); diff --git a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp index 1001ca31..2f506325 100644 --- a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp +++ b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp @@ -176,8 +176,7 @@ void QGeoMapMapboxGLPrivate::removeParameter(QGeoMapParameter *param) QGeoMap::ItemTypes QGeoMapMapboxGLPrivate::supportedMapItemTypes() const { - // TODO https://bugreports.qt.io/browse/QTBUG-58869 - return QGeoMap::MapRectangle | QGeoMap::MapPolygon | QGeoMap::MapPolyline; + return QGeoMap::MapRectangle | QGeoMap::MapCircle | QGeoMap::MapPolygon | QGeoMap::MapPolyline; } void QGeoMapMapboxGLPrivate::addMapItem(QDeclarativeGeoMapItemBase *item) @@ -188,25 +187,32 @@ void QGeoMapMapboxGLPrivate::addMapItem(QDeclarativeGeoMapItemBase *item) case QGeoMap::NoItem: case QGeoMap::MapQuickItem: case QGeoMap::CustomMapItem: - case QGeoMap::MapCircle: return; case QGeoMap::MapRectangle: { - QDeclarativeRectangleMapItem *mapItem = qobject_cast(item); + QDeclarativeRectangleMapItem *mapItem = static_cast(item); QObject::connect(mapItem, &QDeclarativeRectangleMapItem::bottomRightChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem, &QDeclarativeRectangleMapItem::topLeftChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem, &QDeclarativeRectangleMapItem::colorChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); QObject::connect(mapItem->border(), &QDeclarativeMapLineProperties::colorChanged, q, &QGeoMapMapboxGL::onMapItemSubPropertyChanged); QObject::connect(mapItem->border(), &QDeclarativeMapLineProperties::widthChanged, q, &QGeoMapMapboxGL::onMapItemUnsupportedPropertyChanged); } break; + case QGeoMap::MapCircle: { + QDeclarativeCircleMapItem *mapItem = static_cast(item); + QObject::connect(mapItem, &QDeclarativeCircleMapItem::centerChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); + QObject::connect(mapItem, &QDeclarativeCircleMapItem::radiusChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); + QObject::connect(mapItem, &QDeclarativeCircleMapItem::colorChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); + QObject::connect(mapItem->border(), &QDeclarativeMapLineProperties::colorChanged, q, &QGeoMapMapboxGL::onMapItemSubPropertyChanged); + QObject::connect(mapItem->border(), &QDeclarativeMapLineProperties::widthChanged, q, &QGeoMapMapboxGL::onMapItemUnsupportedPropertyChanged); + } break; case QGeoMap::MapPolygon: { - QDeclarativePolygonMapItem *mapItem = qobject_cast(item); + QDeclarativePolygonMapItem *mapItem = static_cast(item); QObject::connect(mapItem, &QDeclarativePolygonMapItem::pathChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem, &QDeclarativePolygonMapItem::colorChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem->border(), &QDeclarativeMapLineProperties::colorChanged, q, &QGeoMapMapboxGL::onMapItemSubPropertyChanged); QObject::connect(mapItem->border(), &QDeclarativeMapLineProperties::widthChanged, q, &QGeoMapMapboxGL::onMapItemUnsupportedPropertyChanged); } break; case QGeoMap::MapPolyline: { - QDeclarativePolylineMapItem *mapItem = qobject_cast(item); + QDeclarativePolylineMapItem *mapItem = static_cast(item); QObject::connect(mapItem, &QDeclarativePolylineMapItem::pathChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem->line(), &QDeclarativeMapLineProperties::colorChanged, q, &QGeoMapMapboxGL::onMapItemSubPropertyChanged); QObject::connect(mapItem->line(), &QDeclarativeMapLineProperties::widthChanged, q, &QGeoMapMapboxGL::onMapItemSubPropertyChanged); @@ -228,11 +234,13 @@ void QGeoMapMapboxGLPrivate::removeMapItem(QDeclarativeGeoMapItemBase *item) case QGeoMap::NoItem: case QGeoMap::MapQuickItem: case QGeoMap::CustomMapItem: - case QGeoMap::MapCircle: return; case QGeoMap::MapRectangle: q->disconnect(static_cast(item)->border()); break; + case QGeoMap::MapCircle: + q->disconnect(static_cast(item)->border()); + break; case QGeoMap::MapPolygon: q->disconnect(static_cast(item)->border()); break; diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp index f79f0a38..f8bd9b4d 100644 --- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp +++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp @@ -86,6 +86,32 @@ QMapbox::Feature featureFromMapRectangle(QDeclarativeRectangleMapItem *mapItem) return QMapbox::Feature(QMapbox::Feature::PolygonType, geometry, {}, getId(mapItem)); } +QMapbox::Feature featureFromMapCircle(QDeclarativeCircleMapItem *mapItem) +{ + static const int circleSamples = 128; + + QList path; + QGeoCoordinate leftBound; + QDeclarativeCircleMapItem::calculatePeripheralPoints(path, mapItem->center(), mapItem->radius(), circleSamples, leftBound); + QList pathProjected; + for (const QGeoCoordinate &c : qAsConst(path)) + pathProjected << mapItem->map()->geoProjection().geoToMapProjection(c); + if (QDeclarativeCircleMapItem::crossEarthPole(mapItem->center(), mapItem->radius())) + mapItem->preserveCircleGeometry(pathProjected, mapItem->center(), mapItem->radius()); + path.clear(); + for (const QDoubleVector2D &c : qAsConst(pathProjected)) + path << mapItem->map()->geoProjection().mapProjectionToGeo(c); + + + QMapbox::Coordinates coordinates; + for (const QGeoCoordinate &coordinate : path) { + coordinates << QMapbox::Coordinate { coordinate.latitude(), coordinate.longitude() }; + } + coordinates.append(coordinates.first()); // closing the path + QMapbox::CoordinatesCollections geometry { { coordinates } }; + return QMapbox::Feature(QMapbox::Feature::PolygonType, geometry, {}, getId(mapItem)); +} + QMapbox::Feature featureFromMapPolygon(QDeclarativePolygonMapItem *mapItem) { const QGeoPath *path = static_cast(&mapItem->geoShape()); @@ -126,6 +152,8 @@ QMapbox::Feature featureFromMapItem(QDeclarativeGeoMapItemBase *item) switch (item->itemType()) { case QGeoMap::MapRectangle: return featureFromMapRectangle(static_cast(item)); + case QGeoMap::MapCircle: + return featureFromMapCircle(static_cast(item)); case QGeoMap::MapPolygon: return featureFromMapPolygon(static_cast(item)); case QGeoMap::MapPolyline: @@ -182,6 +210,7 @@ QList> QMapboxGLStyleChange::addMapItem(QDe switch (item->itemType()) { case QGeoMap::MapRectangle: + case QGeoMap::MapCircle: case QGeoMap::MapPolygon: case QGeoMap::MapPolyline: break; @@ -325,6 +354,8 @@ QList> QMapboxGLStyleSetPaintProperty::from switch (item->itemType()) { case QGeoMap::MapRectangle: return fromMapItem(static_cast(item)); + case QGeoMap::MapCircle: + return fromMapItem(static_cast(item)); case QGeoMap::MapPolygon: return fromMapItem(static_cast(item)); case QGeoMap::MapPolyline: @@ -352,6 +383,23 @@ QList> QMapboxGLStyleSetPaintProperty::from return changes; } +QList> QMapboxGLStyleSetPaintProperty::fromMapItem(QDeclarativeCircleMapItem *item) +{ + QList> changes; + changes.reserve(3); + + const QString id = getId(item); + + changes << QSharedPointer( + new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-opacity"), item->mapItemOpacity())); + changes << QSharedPointer( + new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-color"), item->color())); + changes << QSharedPointer( + new QMapboxGLStyleSetPaintProperty(id, QStringLiteral("fill-outline-color"), item->border()->color())); + + return changes; +} + QList> QMapboxGLStyleSetPaintProperty::fromMapItem(QDeclarativePolygonMapItem *item) { QList> changes; diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange_p.h b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange_p.h index aa81d89f..33737c1d 100644 --- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange_p.h +++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange_p.h @@ -93,6 +93,7 @@ public: private: static QList> fromMapItem(QDeclarativeRectangleMapItem *); + static QList> fromMapItem(QDeclarativeCircleMapItem *); static QList> fromMapItem(QDeclarativePolygonMapItem *); static QList> fromMapItem(QDeclarativePolylineMapItem *); -- cgit v1.2.1 From 18b22e3b8e07871232a39f69d3cd603b5c5b6e0d Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Thu, 24 Aug 2017 16:47:32 +0200 Subject: Fix PositionSource never turning active on android It seems that if m_positionSource gets created too late, PositionSource never becomes active so it never starts pushing position updates. Task-number: QTBUG-62778 Change-Id: I7b375e9f9f1fbe546dfc27fa6bf0c431df393e65 Reviewed-by: Alex Blasche --- src/imports/positioning/qdeclarativepositionsource.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/imports/positioning/qdeclarativepositionsource.cpp b/src/imports/positioning/qdeclarativepositionsource.cpp index b0e990da..05232d51 100644 --- a/src/imports/positioning/qdeclarativepositionsource.cpp +++ b/src/imports/positioning/qdeclarativepositionsource.cpp @@ -559,10 +559,9 @@ QDeclarativePositionSource::PositioningMethods QDeclarativePositionSource::prefe void QDeclarativePositionSource::start() { - if (!m_positionSource) - return; + if (m_positionSource) + m_positionSource->startUpdates(); - m_positionSource->startUpdates(); if (!m_active) { m_active = true; emit activeChanged(); @@ -721,6 +720,12 @@ void QDeclarativePositionSource::componentComplete() static_cast(int(m_preferredPositioningMethods))); setPosition(m_positionSource->lastKnownPosition()); + + if (m_active) + QTimer::singleShot(0, this, SLOT(start())); // delay ensures all properties have been set + } else if (m_active) { + m_active = false; + emit activeChanged(); } if (previousUpdateInterval != updateInterval()) @@ -733,12 +738,6 @@ void QDeclarativePositionSource::componentComplete() emit supportedPositioningMethodsChanged(); emit validityChanged(); - - if (m_active) { - m_active = false; - emit activeChanged(); - } - emit nameChanged(); } } -- cgit v1.2.1 From 1903bfab5d5ceef6df247bbb19c7f7fac26f1edb Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Thu, 31 Aug 2017 09:45:14 +0200 Subject: Fix places_map example view on Android The previous setup enforced a small 360x640 view size on Android which makes no sense on the platform's full screen premise. This patch tells the QML rectangle to adjust to the parent's size and shifts the size limitation to the surrounding QuickView. At the same time the QuickView will automatically change to full screen as per platform requirement. Change-Id: I2dcd0fc345f6c1ef7520bb10116d9f2fe0722dff Reviewed-by: Paolo Angelelli --- examples/location/places_map/main.cpp | 2 ++ examples/location/places_map/places_map.qml | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/location/places_map/main.cpp b/examples/location/places_map/main.cpp index a2cd8fc0..aeb7eaf3 100644 --- a/examples/location/places_map/main.cpp +++ b/examples/location/places_map/main.cpp @@ -46,6 +46,8 @@ int main(int argc, char **argv) QGuiApplication app(argc,argv); QQuickView view; view.setSource(QUrl(QStringLiteral("qrc:///places_map.qml"))); + view.setWidth(360); + view.setHeight(640); view.show(); return app.exec(); } diff --git a/examples/location/places_map/places_map.qml b/examples/location/places_map/places_map.qml index 467a31de..cd487fa9 100644 --- a/examples/location/places_map/places_map.qml +++ b/examples/location/places_map/places_map.qml @@ -45,8 +45,7 @@ import QtLocation 5.6 //! [Imports] Rectangle { - width: 360 - height: 640 + anchors.fill: parent //! [Initialize Plugin] Plugin { -- cgit v1.2.1 From 8f80da7ea0165adb492c71255d0eea5f08c0af8e Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Fri, 1 Sep 2017 19:07:29 +0300 Subject: Fix Mapbox GL plugin not respecting MapItem visibility and opacity Now opacity and visibility will be respected for the fill color as borders are not supported yet. Change-Id: I58f982dc9285537fde770e14238c5d6d903913e6 Reviewed-by: Paolo Angelelli --- src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp | 9 +++++++++ src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp | 13 ++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp index 2f506325..e56fe9b0 100644 --- a/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp +++ b/src/plugins/geoservices/mapboxgl/qgeomapmapboxgl.cpp @@ -190,6 +190,8 @@ void QGeoMapMapboxGLPrivate::addMapItem(QDeclarativeGeoMapItemBase *item) return; case QGeoMap::MapRectangle: { QDeclarativeRectangleMapItem *mapItem = static_cast(item); + QObject::connect(mapItem, &QQuickItem::visibleChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); + QObject::connect(mapItem, &QDeclarativeGeoMapItemBase::mapItemOpacityChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); QObject::connect(mapItem, &QDeclarativeRectangleMapItem::bottomRightChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem, &QDeclarativeRectangleMapItem::topLeftChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem, &QDeclarativeRectangleMapItem::colorChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); @@ -198,6 +200,8 @@ void QGeoMapMapboxGLPrivate::addMapItem(QDeclarativeGeoMapItemBase *item) } break; case QGeoMap::MapCircle: { QDeclarativeCircleMapItem *mapItem = static_cast(item); + QObject::connect(mapItem, &QQuickItem::visibleChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); + QObject::connect(mapItem, &QDeclarativeGeoMapItemBase::mapItemOpacityChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); QObject::connect(mapItem, &QDeclarativeCircleMapItem::centerChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem, &QDeclarativeCircleMapItem::radiusChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem, &QDeclarativeCircleMapItem::colorChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); @@ -206,6 +210,8 @@ void QGeoMapMapboxGLPrivate::addMapItem(QDeclarativeGeoMapItemBase *item) } break; case QGeoMap::MapPolygon: { QDeclarativePolygonMapItem *mapItem = static_cast(item); + QObject::connect(mapItem, &QQuickItem::visibleChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); + QObject::connect(mapItem, &QDeclarativeGeoMapItemBase::mapItemOpacityChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); QObject::connect(mapItem, &QDeclarativePolygonMapItem::pathChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem, &QDeclarativePolygonMapItem::colorChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem->border(), &QDeclarativeMapLineProperties::colorChanged, q, &QGeoMapMapboxGL::onMapItemSubPropertyChanged); @@ -213,6 +219,8 @@ void QGeoMapMapboxGLPrivate::addMapItem(QDeclarativeGeoMapItemBase *item) } break; case QGeoMap::MapPolyline: { QDeclarativePolylineMapItem *mapItem = static_cast(item); + QObject::connect(mapItem, &QQuickItem::visibleChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); + QObject::connect(mapItem, &QDeclarativeGeoMapItemBase::mapItemOpacityChanged, q, &QGeoMapMapboxGL::onMapItemPropertyChanged); QObject::connect(mapItem, &QDeclarativePolylineMapItem::pathChanged, q, &QGeoMapMapboxGL::onMapItemGeometryChanged); QObject::connect(mapItem->line(), &QDeclarativeMapLineProperties::colorChanged, q, &QGeoMapMapboxGL::onMapItemSubPropertyChanged); QObject::connect(mapItem->line(), &QDeclarativeMapLineProperties::widthChanged, q, &QGeoMapMapboxGL::onMapItemSubPropertyChanged); @@ -391,6 +399,7 @@ void QGeoMapMapboxGL::onMapItemPropertyChanged() QDeclarativeGeoMapItemBase *item = static_cast(sender()); d->m_styleChanges << QMapboxGLStyleSetPaintProperty::fromMapItem(item); + d->m_styleChanges << QMapboxGLStyleSetLayoutProperty::fromMapItem(item); emit sgNodeChanged(); } diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp index f8bd9b4d..69bb6e4b 100644 --- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp +++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp @@ -279,13 +279,20 @@ QList> QMapboxGLStyleSetLayoutProperty::fro QList> QMapboxGLStyleSetLayoutProperty::fromMapItem(QDeclarativeGeoMapItemBase *item) { + QList> changes; + switch (item->itemType()) { case QGeoMap::MapPolyline: - return fromMapItem(static_cast(item)); + changes = fromMapItem(static_cast(item)); default: - qWarning() << "Unsupported QGeoMap item type: " << item->itemType(); - return QList>(); + break; } + + changes << QSharedPointer( + new QMapboxGLStyleSetLayoutProperty(getId(item), QStringLiteral("visibility"), + item->isVisible() ? QStringLiteral("visible") : QStringLiteral("none"))); + + return changes; } QList> QMapboxGLStyleSetLayoutProperty::fromMapItem(QDeclarativePolylineMapItem *item) -- cgit v1.2.1