Solve it by:
Creating and EmitPoint too;:
mpSelectTool = new QgsMapToolEmitPoint(mpMapCanvas);
mpSelectTool->setAction(selectAct);
Connecting the signal canvasClicked to a custom slot
connect(mpSelectTool,SIGNAL(canvasClicked(QgsPoint,Qt::MouseButton)),this,SLOT(pointSelected(QgsPoint,Qt::MouseButton)));
Custom slot
void browseMap::pointSelected(QgsPoint point, Qt::MouseButton button)
{
QgsPoint end(point);
end.setX(point.x()+0.1);
end.setY(point.y()+0.1);
QgsRectangle rect(point,end); //Very small rectangle because if
point = end QGIS select all shapes
QgsMapLayer * currlayer; //A layer
currlayer = myList[0].layer(); //My layer of interest
if (qobject_cast<QgsVectorLayer *>(currlayer)) //If it is a
shape layer
{
qobject_cast<QgsVectorLayer
*>(currlayer)->select(rect,false); //Select the shape
}
}
Hope this help others.
Carlos.
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Selecting-a-shape-with-the-mouse-tp5560908p5564025.html
Sent from the qgis-developer mailing list archive at Nabble.com.
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer