[Qgis-developer] Using the C++ API (loading style from *.qml file, general documentation regarding the C++ API)

Jamil Raichouni raichouni at gmail.com
Mon Mar 18 09:23:34 PDT 2013


Dear all,

having no experience with mailing lists I tried to find kind of a QGIS
forum, but did not find anyone.

I hope, it is the right place to ask the following questions and may find
some help :-)

1)
I launched the first tutorial describing the first simple use of the QGIS
API (findable under
https://github.com/qgis/qgis-code-examples/tree/master/1_hello_world_qgis_style)
and would like to know, why I get the app output:

 *Layer is valid*
* *

*QWidget::repaint: Recursive repaint detected*
* *

*QPainter::begin: Widget painting can only begin as a result of a paintEvent
*
* *

*QPainter::setRenderHint: Painter must be active to set rendering hints*
* *

*QPainter::setRenderHint: Painter must be active to set rendering hints*
* *

*QPainter::worldTransform: Painter not active*
* *

*QPainter::save: Painter not active*
* *

*QPainter::restore: Unbalanced save/restore*
* *

*QPainter::setWorldTransform: Painter not active*
* *

*QPainter::save: Painter not active*
* *

*QPainter::setOpacity: Painter not active*
* *

*QPainter::restore: Unbalanced save/restore*
* *

*QPainter::setWorldTransform: Painter not active*
* *

*QPainter::end: Painter not active, aborted*


The only change from my side was the adaption of the pathes to the plugins
directory and my smal spatialite database.


2)

I opened my database in QGIS application and created a *.qml style file,
but how do I apply such a style to a QgsVectorLayer using the C++ API?

I tried the following without success:


*const QString myLayerStylePath = app->applicationDirPath() +
"/../rsc/styles/lines.qml";*

*bool resultFlag;
QString errorMsg = mypLayer->loadNamedStyle( myLayerStylePath, resultFlag );
if ( !resultFlag ) {
qDebug() << errorMsg;
}*

*
*

There was no error message but no rendering too!?


3)

Is there any detailed documentation for the use of the API? The only not
really complete one I found is http://www.qgis.org/pyqgis-cookbook**

4)
My last question I hope to find any help is: How do I search throw the
discussions in the mailing list to avoid to ask duplicated questions?

Many thanks
joomie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130318/7ec0994c/attachment-0001.html>


More information about the Qgis-developer mailing list