[QGIS-Developer] Upgrading to V3

Maaza Mekuria mcmekuria at gmail.com
Sun Sep 15 01:10:49 PDT 2019


QGIS Layer List upgrade to V3 C++ plugin - Geographic Information Systems
Stack Exchange <style>body,.top-bar{margin-top:1.9em}</style>

I was upgrading a c++ plugin that I had used in the past and almost
eliminated all the the usual compiler errors due to version changes
according for the current version (3.6). The plugin used to collect current
map canvas layers in a combo list box for selection. I am getting two
errors that I can't figure out what to do with. This code compiled without
problem pre-2.0.

The first happens to be about QGSMapLayer that can't be instantiated
because it is turned as an abstract class and I am getting an error
[Severity Code Description Project File Line Source Suppression State Error
C2259 'QgsMapLayer': cannot instantiate abstract class tarjan_sccplugin
C:\OSGeo4W64\apps\Qt5\include\QtCore\qlist.h 214 Build ]

This is portion of the code generating the error.  Where cmbNetSourceLayer
is a combo-box .

void tarjan_sccGui::populateLayers( QString const& url ) {
cmbNetSourceLayer->clear();

QString layerName; QString layerType;

// fill list of layersQMap<QString, QgsMapLayer*> mapLayers =
QgsProject::instance()->mapLayers();QMap<QString,
QgsMapLayer*>::iterator layer_it = mapLayers.begin();
for (; layer_it != mapLayers.end(); ++layer_it){
    QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>(layer_it.value());
    if (!vl)
        continue;
    else

     cmbNetSourceLayer->addItem(vl->name() );}

The second error appears to be in explicit declaration for the plugin.
Something has changed in how the plugins are initiated. [Severity Code
Description Project File Line Source Suppression State Error (active)
invalid explicit instantiation declaration tarjan_sccplugin
d:\GIS\v3\Quantum-GIS\src\core\qgsoptionalexpression.h 82 IntelliSense ]

No idea what must be done to overcome this error.  The cited module appears
to be an optional data module.


Any help is appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190914/3433c2b9/attachment.html>


More information about the QGIS-Developer mailing list