[Qgis-developer] QGIS Custom Feature Form without Borders

JoshS josh-talk at hotmail.com
Tue Mar 3 12:03:07 PST 2015


I found a way to do it by creating a custom identify tool:

--------------------------------------------
import qgis.utils
from qgis.gui import QgsMapToolIdentify
from PyQt4.Qt import Qt
from PyQt4.QtGui import QMessageBox

class CustomIdentifyTool(QgsMapToolIdentify):
    
    def __init__(self, canvas, qgsMapToolIdentifyAction):
        QgsMapToolIdentify.__init__(self, canvas)
        self.canvas = canvas
        self.qgsMapToolIdentifyAction = qgsMapToolIdentifyAction
        
    def canvasReleaseEvent(self, mouseEvent):
        results = self.identify(mouseEvent.x(),mouseEvent.y(),
self.TopDownStopAtFirst, self.VectorLayer)
        if len(results) > 1:
            QMessageBox.information(None, "Info", u"More than one object!") 
        elif len(results) == 1:
            featureForm = qgis.utils.iface.getFeatureForm(results[0].mLayer,
results[0].mFeature)
            featureForm.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint)
            featureForm.show()
        else:
            self.qgsMapToolIdentifyAction.canvasReleaseEvent(mouseEvent)
--------------------------------------------

Josh



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/QGIS-Custom-Feature-Form-without-Borders-tp5191227p5191282.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list