[QGIS-Developer] pyqgis - openfeatureform highlight?
Anders Vittrup
anvit2a at gmail.com
Thu Oct 5 11:05:15 PDT 2017
Hi,
I have now done some testing and with qgisinterface it is possible to get
the QgsAttributeDialog with getfeatureform then it is possible to use
setHighlight and assign the QgsHighlight.
Now the last problem. In the docs for QgsHighlight
QgsHighlight::QgsHighlight ( QgsMapCanvas
<http://qgis.org/api/2.14/classQgsMapCanvas.html> * mapCanvas,
const QgsGeometry <http://qgis.org/api/2.14/classQgsGeometry.html> * geom,
QgsVectorLayer <http://qgis.org/api/2.14/classQgsVectorLayer.html> * layer
)
And
QgsHighlight::QgsHighlight ( QgsMapCanvas
<http://qgis.org/api/2.14/classQgsMapCanvas.html> * mapCanvas,
const QgsFeature <http://qgis.org/api/2.14/classQgsFeature.html> &
feature,
QgsVectorLayer <http://qgis.org/api/2.14/classQgsVectorLayer.html> * layer
)
It should be possible to construct a QgsHighlight with a true feature shape
based on the styling. I get an error when passing QgsFeature. It seems that
only QgsGeometry is supported?
Anyone knows if this is an error or is it possible to construct the
highlight with true feature shape?
Best regards
Anders
man. 25. sep. 2017 kl. 18.10 skrev Anders Vittrup <anvit2a at gmail.com>:
> Hi,
>
> I'm making a small plugin for a custom editorwidget and I'm using
> QgisInterface openFeatureForm from within my widget to open other feature
> forms on diffrent layers.
>
> I just cannot seem to figure out how to make the feature being highlighted
> on the map (red highlighing when using the identify feature tool).
> I already have a tool that will "flash" a feature for like half a second
> (Using QgsRubberBand) but that is not what i want for the new feature form.
> How do i get the same effect when the feature form is opened (with pyqgis)
> so it will also highlight the feature on the map. Eg. if i have two feature
> form's open an active one the feature is highlighted (exactly like identify
> feature). (when the feature form is closed or inactive the highlight should
> disappear)
>
> Best regards
> Anders
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20171005/8fb75b73/attachment.html>
More information about the QGIS-Developer
mailing list