ArcGIS map not working well with QDockWidget

09-01-2019 09:38 PM
New Contributor

I've tried integrating ArcGIS into my application in Qt.

I am using QDockWidgets to display the map.

I have tried using both C++ and QML to display the maps but both versions are rather buggy when it works with QDockWidgets.

Note : I need to use both ArcGIS map and OSM for my project where I need to switch between the two.

There is a mode switcher, meaning all my maps in QML will display either OSM (in OSM mode) and ArcGIS (in ArcGIS mode) and not both at the same time. If I were to create a new QDockWidget, the map will display according to the current mode.

In QML :

- I create a QDockWidget in ArcGIS mode. I switch to OSM mode. I create a new QDockWidget. I switch back to ArcGIS mode. Program crashes. [It sometimes takes a multiple new QDockWidget to create to crash].

- According to the log, whenever I open 2 QDockWidgets in ArcGIS mode or more and close application, it states that the application crashes and does not close successfully.

In C++ :

-If I use QGraphicsDropShadowEffect enabled with the QDockWidget, the map will not display. I need to display a shadow effect.

-The map will stop being displayed when the QDockWidget is undocked from the window.

These issues does not occur when I use OSM. I hope someone is able to guide me along to rectify this issues.

Here is the link to my project : 

GitHub - haikalsyed/QDockWidgetArcGIS 

0 Kudos
3 Replies
Esri Frequent Contributor

Hi Haikal-

I took a look at your project. There's a few things going on here:

First off, regarding the QML w/ QDockWidgets - If you are ultimately creating a QWidgets based application, why create your MapView in QML and then display as a QQuickView inside a QDockWidget? We don't really test for this scenario and would recommend you use our C++ Widgets API (MapGraphicsView). We generally would recommend a user to use either our C++ API OR our QML API within an application.

Second question would be if you could consider just using our C++ API with Widgets view for the OpenStreetMap component. We have an OpenStreetMap Basemap type that you could just add to your ArcGIS Map type, which would mean you would have all of your code in C++ with Runtime and wouldn't need Qt Location as well. This is just a suggestion that might help simplify your workflow and you won't need to maintain 2 separate mapping workflows (Qt Location and Runtime) in the same app.

Regarding drop shadow, it does seem like something is wrong here. I'll log an issue for us to investigate. I was able to reproduce by taking our Display a Map sample ( and adding the below lines to it. A workaround I noticed was that if I interact with the map, the map displays again, so I can force a redraw by setting the viewpoint, and it works again. Maybe you can try adding something similar to workaround the issue.

DisplayMap::DisplayMap(QWidget* parent) :
// Create a map using a basemap
m_map = new Map(Basemap::imagery(this), this);

// Create a map view, and pass in the map
m_mapView = new MapGraphicsView(m_map, this);

// create drop shadow effect
QGraphicsDropShadowEffect* shadow = new QGraphicsDropShadowEffect(this);

// Set up the UI
QVBoxLayout *vBoxLayout = new QVBoxLayout();

// add button
QPushButton* pushButton = new QPushButton(this);
pushButton->setText("Add Drop Shadow");
connect(pushButton, &QPushButton::clicked, this, [=]()
// set viewpoint which will force a re-draw
m_mapView->setViewpointScale(m_mapView->mapScale() + 1);
m_mapView->setViewpointScale(m_mapView->mapScale() - 1);


Regarding the docking issue, I am seeing this issue as well with our C++ Widgets API. I'll need to log a work item to look at this.

0 Kudos
New Contributor

Hi Lucas,

Sorry for the late reply.

I was figuring out a way for QML to have the same kind of functionality with qdockwidgets. But I can't seem to find an answer.

Another reason for using QML is that I wanted to be able to customise stuff, inside the qml. Meaning, there are plenty of toolbars and animations inside the qml. Not just the map itself.

Can I confirm that there is no fix for QML > QQuickView > QDockWidgets?

Thanks for replying!

0 Kudos
Esri Frequent Contributor

QDockWidget seems like an issue we need to fix in the API. We still need to investigate more but are currently unaware of any workaround.

0 Kudos