[Qgis-developer] Access to Run Feature Action tool from API

Denis Rouzaud denis.rouzaud at gmail.com
Mon Nov 11 05:58:36 PST 2013


Ah, ok, sorry.

Not sure you can actually set a predefined map tool using the API since 
mFeatureAction is defined in a private class Tools [0].
I would ask confirmation for this.

Otherwise, you could create your own map tool QgsMapToolFeatureAction 
with your defined action. You can use as example the code in [1] and 
[2], that would be:
featureAction = new QgsMapToolFeatureAction( self.iface.mapCanvas() )
featureAction->setAction( yourAction )
self.iface.mapCanvas().setMapTool( featureAction )

Hope it helps a bit.

Cheers,

Denis

[0] https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.h#L1337
[1] https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.cpp#L1981
[2] https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.cpp#L4196


On 11/11/2013 02:27 PM, Thomas Colley wrote:
>
> Hi Denis
>
> Thanks for your reply.
>
> What I'm trying to do is set Run Feature Action to be the active tool 
> (equivalent of user pressing the action button on the attributes 
> toolbar) rather than actually programmatically firing the action itself.
>
> This command does exactly what I'm looking for but with the identify tool
>
> qgis.utils.iface.actionIdentify().trigger()
>
> Hope this makes sense
>
> Thanks again
>
> Tom
>
> *From:*Denis Rouzaud [mailto:denis.rouzaud at gmail.com]
> *Sent:* 11 November 2013 12:37
> *To:* Thomas Colley; qgis-developer at lists.osgeo.org
> *Subject:* Re: [Qgis-developer] Access to Run Feature Action tool from API
>
> Hi Thomas,
>
> This should do the job:
>
> layer.actions().doAction( idx, feature )
>
> QgsAttributeAction is a registry, and you can run/add/remove action 
> from it.
> http://qgis.org/api/classQgsAttributeAction.html
>
> Cheers,
>
> Denis
>
> On 11/11/2013 11:12 AM, Thomas Colley wrote:
>
>     Hi Everyone
>
>       
>
>     Is there a way to access the Run Feature Action tool from the API?
>
>       
>
>     Most other tools can be switched with
>
>       
>
>     qgis.utils.iface.action...().trigger()
>
>       
>
>     but I can't see any reference to the action tool in there.
>
>       
>
>     In the API I can see actionFeatureAction under QgisApp and
>
>     QgisAppInterface but I'm not sure how to or if they can be accessed from
>
>     inside QGIS.
>
>       
>
>     Thanks
>
>       
>
>     Tom
>
>       
>
>       
>
>     -----Original Message-----
>
>     From:qgis-developer-bounces at lists.osgeo.org  <mailto:qgis-developer-bounces at lists.osgeo.org>
>
>     [mailto:qgis-developer-bounces at lists.osgeo.org] On Behalf Of
>
>     qgis-developer-request at lists.osgeo.org  <mailto:qgis-developer-request at lists.osgeo.org>
>
>     Sent: 09 November 2013 20:00
>
>     To:qgis-developer at lists.osgeo.org  <mailto:qgis-developer at lists.osgeo.org>
>
>     Subject: Qgis-developer Digest, Vol 97, Issue 26
>
>       
>
>     Send Qgis-developer mailing list submissions to
>
>        qgis-developer at lists.osgeo.org  <mailto:qgis-developer at lists.osgeo.org>
>
>       
>
>     To subscribe or unsubscribe via the World Wide Web, visit
>
>        http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>     or, via email, send a message with subject or body 'help' to
>
>        qgis-developer-request at lists.osgeo.org  <mailto:qgis-developer-request at lists.osgeo.org>
>
>       
>
>     You can reach the person managing the list at
>
>        qgis-developer-owner at lists.osgeo.org  <mailto:qgis-developer-owner at lists.osgeo.org>
>
>       
>
>     When replying, please edit your Subject line so it is more specific than
>
>     "Re: Contents of Qgis-developer digest..."
>
>       
>
>       
>
>     Today's Topics:
>
>       
>
>         1. Re: Roadmap for 2.2 (Nathan Woodrow)
>
>         2. Re: Roadmap for 2.2 (Marco Bernasocchi)
>
>         3. Re: Bug with avoid intersection - willing to fund fix
>
>            (Sandro Santilli)
>
>         4. Re: Roadmap for 2.2 (Richard Duivenvoorde)
>
>         5. Re: Bug with avoid intersection - willing to fund        fix
>
>            (George Silva)
>
>         6. Plugin [233] Contour plugin approval notification.
>
>            (noreply at qgis.org  <mailto:noreply at qgis.org>)
>
>       
>
>       
>
>     ----------------------------------------------------------------------
>
>       
>
>     Message: 1
>
>     Date: Sat, 9 Nov 2013 20:14:43 +1000
>
>     From: Nathan Woodrow<madmanwoo at gmail.com>  <mailto:madmanwoo at gmail.com>
>
>     To:"qgis-developer at lists.osgeo.org"  <mailto:qgis-developer at lists.osgeo.org>  <qgis-developer at lists.osgeo.org>  <mailto:qgis-developer at lists.osgeo.org>
>
>     Subject: Re: [Qgis-developer] Roadmap for 2.2
>
>     Message-ID:
>
>        
>
>     <CAAi8Yg9mz-BYJb1cHC1xTioeiD1_oXc81uSrZL42wqbnLtRYXA at mail.gmail.com>  <mailto:CAAi8Yg9mz-BYJb1cHC1xTioeiD1_oXc81uSrZL42wqbnLtRYXA at mail.gmail.com>
>
>     Content-Type: text/plain; charset="iso-8859-1"
>
>       
>
>     +1 to feb/jun/oct for me.
>
>       
>
>     - Nathan
>
>     -------------- next part --------------
>
>     An HTML attachment was scrubbed...
>
>     URL:
>
>     <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131109/af  <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131109/af637a85/attachment-0001.html>
>
>     637a85/attachment-0001.html>  <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131109/af637a85/attachment-0001.html>
>
>       
>
>     ------------------------------
>
>       
>
>     Message: 2
>
>     Date: Sat, 9 Nov 2013 11:32:31 +0100
>
>     From: Marco Bernasocchi<marco at bernawebdesign.ch>  <mailto:marco at bernawebdesign.ch>
>
>     To: qgis-developer<qgis-developer at lists.osgeo.org>  <mailto:qgis-developer at lists.osgeo.org>
>
>     Subject: Re: [Qgis-developer] Roadmap for 2.2
>
>     Message-ID:
>
>        
>
>     <CALWXeEFdEwaCr764pywm6vyCLB9nkRqcMeeVuf12G0iDpknUnQ at mail.gmail.com>  <mailto:CALWXeEFdEwaCr764pywm6vyCLB9nkRqcMeeVuf12G0iDpknUnQ at mail.gmail.com>
>
>     Content-Type: text/plain; charset="iso-8859-1"
>
>       
>
>     I d try to avoid august and December due to many people having holidays.
>
>       
>
>     jan/may/sep would coincide with the hack fest which might be sub
>
>     optimal.
>
>       
>
>     +1 for feb/jun/oct or mar/jul/nov
>
>       
>
>     if we consider the hack fest in sept/april, then the feb schedule would
>
>     have the hackfest in the feature freeze month while the march schedule
>
>     not.
>
>       
>
>     opinions?
>
>       
>
>     ciao
>
>       
>
>     Marco Bernasocchi (mobile)
>
>     http://opengis.ch
>
>     On 9 Nov 2013 18:13, "J?rgen E."<jef at norbit.de>  <mailto:jef at norbit.de>  wrote:
>
>       
>
>         Hi,
>
>           
>
>         On Tue, 05. Nov 2013 at 13:37:12 +0100, Vincent Picavet wrote:
>
>                 Does jan/may/sep sound preferable?  feb/jun/oct or mar/jul/nov or
>
>                 apr/aug/dec any better?  Any preference on the week or weekday
>
>                 such a release should happen (eg. 3rd friday of the month)?
>
>           
>
>             Better not have a release in august because of summer holidays.
>
>             feb/jun/oct would be my favorite.
>
>           
>
>         Anyone else?
>
>           
>
>           
>
>         J?rgen
>
>           
>
>           
>
>         --
>
>         J?rgen E. Fischer         norBIT GmbH               Tel.
>
>     +49-4931-918175-31
>
>         Dipl.-Inf. (FH)           Rheinstra?e 13            Fax.
>
>     +49-4931-918175-50
>
>         Software Engineer         D-26506 Norden
>
>         http://www.norbit.de
>
>         QGIS PSC member (RM)                                   IRC: jef on
>
>     FreeNode
>
>           
>
>         --
>
>         norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme
>
>         mbH Rheinstrasse 13, 26506 Norden
>
>         GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502
>
>           
>
>         _______________________________________________
>
>         Qgis-developer mailing list
>
>         Qgis-developer at lists.osgeo.org  <mailto:Qgis-developer at lists.osgeo.org>
>
>         http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>           
>
>     -------------- next part --------------
>
>     An HTML attachment was scrubbed...
>
>     URL:
>
>     <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131109/56  <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131109/564bb605/attachment-0001.html>
>
>     4bb605/attachment-0001.html>  <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131109/564bb605/attachment-0001.html>
>
>       
>
>     ------------------------------
>
>       
>
>     Message: 3
>
>     Date: Sat, 9 Nov 2013 12:18:27 +0100
>
>     From: Sandro Santilli<strk at keybit.net>  <mailto:strk at keybit.net>
>
>     To: George Silva<georger.silva at gmail.com>  <mailto:georger.silva at gmail.com>
>
>     Cc: qgis-developer<qgis-developer at lists.osgeo.org>  <mailto:qgis-developer at lists.osgeo.org>,   Giovanni Manghi
>
>        <giovanni.manghi at faunalia.pt>  <mailto:giovanni.manghi at faunalia.pt>
>
>     Subject: Re: [Qgis-developer] Bug with avoid intersection - willing to
>
>        fund fix
>
>     Message-ID: <20131109111827.GA4496 at cdb>
>
>     Content-Type: text/plain; charset=us-ascii
>
>       
>
>     On Thu, Nov 07, 2013 at 04:26:32PM -0200, George Silva wrote:
>
>         QGis does the explicit noding of the first adjancent feature, but the
>
>         results are inconsistent.
>
>       
>
>     Noding should involve all nearby features, updating each of them to
>
>     include the new node.
>
>       
>
>         Sometimes it works, sometimes it doesnt. I've tried many things to see
>
>       
>
>         if I could find a reproducible series of steps, but without success.
>
>       
>
>     I bet, it's not easy to "manually" put points in critical spots of a
>
>     floating point grid !
>
>       
>
>     --strk;
>
>       
>
>       
>
>     ------------------------------
>
>       
>
>     Message: 4
>
>     Date: Sat, 09 Nov 2013 13:05:57 +0100
>
>     From: Richard Duivenvoorde<rdmailings at duif.net>  <mailto:rdmailings at duif.net>
>
>     To:qgis-developer at lists.osgeo.org  <mailto:qgis-developer at lists.osgeo.org>
>
>     Subject: Re: [Qgis-developer] Roadmap for 2.2
>
>     Message-ID:<527E2525.9090000 at duif.net>  <mailto:527E2525.9090000 at duif.net>
>
>     Content-Type: text/plain; charset=ISO-8859-1
>
>       
>
>     On 05-11-13 11:23, J?rgen E. Fischer wrote:
>
>         Does jan/may/sep sound preferable?  feb/jun/oct or mar/jul/nov or
>
>         apr/aug/dec any better?  Any preference on the week or weekday such a
>
>         release should happen (eg. 3rd friday of the month)?
>
>       
>
>     Good plan! I do not care which three months, it will always coincide
>
>     with something or a holiday somewhere in the world :-)
>
>       
>
>     Pick one, and let us try to stick to that.
>
>       
>
>     Regards,
>
>       
>
>     Richard
>
>       
>
>       
>
>     ------------------------------
>
>       
>
>     Message: 5
>
>     Date: Sat, 9 Nov 2013 10:32:22 -0200
>
>     From: George Silva<georger.silva at gmail.com>  <mailto:georger.silva at gmail.com>
>
>     To: George Silva<georger.silva at gmail.com>  <mailto:georger.silva at gmail.com>, kimaidou
>
>        <kimaidou at gmail.com>  <mailto:kimaidou at gmail.com>,  Giovanni Manghi
>
>     <giovanni.manghi at faunalia.pt>  <mailto:giovanni.manghi at faunalia.pt>,
>
>        qgis-developer<qgis-developer at lists.osgeo.org>  <mailto:qgis-developer at lists.osgeo.org>
>
>     Subject: Re: [Qgis-developer] Bug with avoid intersection - willing to
>
>        fund    fix
>
>     Message-ID:
>
>        
>
>     <CAGyPVTuNG3MSAfTTGSMHVxmnH2NR2SfEr1MgefaJG00vqWUoDw at mail.gmail.com>  <mailto:CAGyPVTuNG3MSAfTTGSMHVxmnH2NR2SfEr1MgefaJG00vqWUoDw at mail.gmail.com>
>
>     Content-Type: text/plain; charset="iso-8859-1"
>
>       
>
>     Any comments from the QGis crowd?
>
>       
>
>     Thanks
>
>       
>
>       
>
>     On Sat, Nov 9, 2013 at 9:18 AM, Sandro Santilli<strk at keybit.net>  <mailto:strk at keybit.net>  wrote:
>
>       
>
>         On Thu, Nov 07, 2013 at 04:26:32PM -0200, George Silva wrote:
>
>             QGis does the explicit noding of the first adjancent feature, but
>
>             the results are inconsistent.
>
>           
>
>         Noding should involve all nearby features, updating each of them to
>
>         include the new node.
>
>           
>
>             Sometimes it works, sometimes it doesnt. I've tried many things to
>
>             see
>
>         if I
>
>             could find a reproducible series of steps, but without success.
>
>           
>
>         I bet, it's not easy to "manually" put points in critical spots of a
>
>         floating point grid !
>
>           
>
>         --strk;
>
>           
>
>       
>
>       
>
>       
>
>     --
>
>     George R. C. Silva
>
>     SIGMA Consultoria
>
>     ----------------------------
>
>     http://www.consultoriasigma.com.br/
>
>     -------------- next part --------------
>
>     An HTML attachment was scrubbed...
>
>     URL:
>
>     <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131109/7e  <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131109/7e64e09f/attachment-0001.html>
>
>     64e09f/attachment-0001.html>  <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131109/7e64e09f/attachment-0001.html>
>
>       
>
>     ------------------------------
>
>       
>
>     Message: 6
>
>     Date: Sat, 09 Nov 2013 17:53:58 -0000
>
>     From:noreply at qgis.org  <mailto:noreply at qgis.org>
>
>     To:ccrook at linz.govt.nz  <mailto:ccrook at linz.govt.nz>,ccrook at linz.govt.nz  <mailto:ccrook at linz.govt.nz>,
>
>        qgis-developer at lists.osgeo.org  <mailto:qgis-developer at lists.osgeo.org>
>
>     Subject: [Qgis-developer] Plugin [233] Contour plugin approval
>
>        notification.
>
>     Message-ID:<20131109175358.1426.36911 at qgis.osgeo.osuosl.org>  <mailto:20131109175358.1426.36911 at qgis.osgeo.osuosl.org>
>
>     Content-Type: text/plain; charset="utf-8"
>
>       
>
>       
>
>     Plugin Contour plugin approval by ccrook.
>
>     The plugin version "[233] Contour plugin 1.0.3" is now unapproved
>
>     Link:http://plugins.qgis.org/plugins/contour/
>
>       
>
>       
>
>     ------------------------------
>
>       
>
>     _______________________________________________
>
>     Qgis-developer mailing list
>
>     Qgis-developer at lists.osgeo.org  <mailto:Qgis-developer at lists.osgeo.org>
>
>     http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>       
>
>     End of Qgis-developer Digest, Vol 97, Issue 26
>
>     **********************************************
>
>       
>
>       
>
>     _______________________________________________
>
>     Qgis-developer mailing list
>
>     Qgis-developer at lists.osgeo.org  <mailto:Qgis-developer at lists.osgeo.org>
>
>     http://lists.osgeo.org/mailman/listinfo/qgis-developer
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131111/f1bbbad5/attachment-0001.html>


More information about the Qgis-developer mailing list