[Qgis-user] QGIS API QgsMapToolEmitPoint Is Not Working Now and QGIS Crashes

Bob Bruce Bob.Bruce at pobox.com
Wed Aug 26 07:21:45 PDT 2009


Something strange is happening, a plugin that was working before has 
stopped working for me now. I recently set up a new Windows XP system 
(which has been fully patched) and then installed QGIS 1.0, 1.1.0 and 
1.2 along with the libraries using the OSGEO4W installer. It has been 
two months since I have been using this plugin but I don't suppose that 
the API has changed in that time?

When I run my plugin in QGIS 1.1.0 (Pan) the Python code in the plugin 
enables the mouse clicks on the canvas to be captured and when I move 
the cursor on the mapcanvas I see a cross-hair cursor but as soon as I 
click on the canvas a Windows dialog appears with the message "qgis.exe 
has encountered a problem and needs to close" and QGIS crashes. The slot 
function never seems to be entered because the QMessageBox at the top of 
it never appears before the crash. Shown below is a snippet of my Python 
code in which I have added some calls to QMessageBox in the function 
setUpRubberBanding and these get called but the message box in 
setClipWindow never gets called before the crash.

What would be causing this QGIS crash?

thanks,
             Bob Bruce

     def setUpRubberBanding(self):
         -
         -
         (ommitted code)
         -
         -
         self.canvas = self.iface.mapCanvas()
         QMessageBox.information(self,'ImageClipperDlg - ClipImage','In 
Function: setUpRubberBanding'+\
         ' Map Canvas Scale = "' + str(self.canvas.scale()) + '"')
         self.emitPoint = QgsMapToolEmitPoint(self.canvas)
         self.canvas.setMapTool(self.emitPoint)
         QMessageBox.information(self,'ImageClipperDlg - ClipImage','In 
Function: setUpRubberBanding'+\
                                 ' about to connect signal "canvasClicked"')
         QObject.connect(self.emitPoint, SIGNAL("canvasClicked(QgsPoint 
&, Qt::MouseButton)"), self.setClipWindow)
         self.isEmittingPoint = True

     def setClipWindow(self, point, button):
         QMessageBox.information(self,'ImageClipperDlg - 
ClipImage','Entered Function: setClipWindow')
-------------- next part --------------

No virus found in this outgoing message.
Checked by AVG - www.avg.com 
Version: 8.5.392 / Virus Database: 270.13.67/2326 - Release Date: 08/25/09 18:07:00


More information about the Qgis-user mailing list