SHARE
TWEET

Untitled

a guest Jun 16th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. QgsProviderRegistry::instance(qgisPluginPath);
  2.  
  3.    pLayerFromProvider = new QgsVectorLayer(
  4.                filePath.toUtf8(),
  5.                SL_LayerList.at(index.row()).toUtf8() ,
  6.                "ogr");
  7.  
  8.    pLayerRenderer = new QgsSingleSymbolRenderer(
  9.                     QgsSymbol::defaultSymbol(pLayer->geometryType()));
  10.  
  11.    pLayer->setRenderer(pLayerRenderer);
  12.  
  13.    if (pLayer->isValid()) qDebug("Layer is valid");
  14.    else                   qDebug("Layer is NOT valid");
  15.  
  16.    pLayerSet = new QList <QgsMapLayer*>;
  17.    pLayerSet->append(pLayer);
  18.  
  19.    QgsProject::instance()->addMapLayers( *pLayerSet );
  20.  
  21.  //pMapCanvas was created
  22.    pMapCanvas->setLayers(*pLayerSet);
  23.    pMapCanvas->resize(500,500);
  24.  
  25.    pMapCanvas->refresh();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top