<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Implementation:<br>
      <br>
      Starting position:<br>
      <br>
      Two attribute tables with geodata and attributes, linked with each
      other in the layer properties dialog.<br>
      When you click on an object in the map, the corresponding line to
      the second object should be drawn.<br>
      If you click again, nothing more may be drawn.<br>
      If object B is set so that the lines should be displayed, then all
      objects A should display the line regardless of a selection.<br>
      <br>
      Symbol code:<br>
      <br>
      Geometry generator -> LineString<br>
      <br>
      if ("tab2_show_lines" = true OR is_selected () OR "tab1_hv",<br>
      make_line (make_point ("x1", "y1"), make_point ("x2", "y2")), '')<br>
      <br>
      <br>
      <br>
      Action Script -> Layer Properties -> Actions -> Add New
      -> Python<br>
      <br>
      <br>
      <br>
      Python code:<br>
      <br>
      from qgis.utils import iface<br>
      <br>
      layer_id = '[% @ layer_id%]'<br>
      layer_obj = QgsProject (). instance (). mapLayer (layer_id)<br>
      <br>
      fid = [% $ id%]<br>
      hv = False if "[% hv%]" == 'false' else True<br>
      <br>
      # QtWidgets.QMessageBox.information (None, "Clicked coords",
      "layer: [% @layer_id%] \ ncoords: ([% @click_x%], [% @click_y%])")<br>
      # QtWidgets.QMessageBox.information (None, "fld", str (fld) + "" +
      str (hv))<br>
      <br>
      layer_obj.startEditing ()<br>
      layer_obj.changeAttributeValue (fid, fld, not hv)<br>
      layer_obj.commitChanges ()<br>
      <br>
      <br>
      <br>
      ---<br>
      <br>
      <br>
      <br>
      Cons / Problems / Known Limitations<br>
      <br>
      Action:<br>
      <br>
      Just click, no hover<br>
      Action can only be displayed via a combination button, not as a
      separate button<br>
      Difficult to write action script (many clicks to get to the
      editor)<br>
      The layer with the Actionscript must be active / selected<br>
      You always have to select the action separately before clicking<br>
      <br>
      <br>
      Symbol:<br>
      <br>
      Line not visible if the source object is not in the view (target
      object does not matter), source / target connected by a link<br>
    </p>
    <p><br>
    </p>
    <p>Limitation:</p>
    <p>My knowledge of python ;-)<br>
      <br>
      ---<br>
      <br>
      <br>
      <br>
      Missing features<br>
      <br>
      Edit project variables using the same action as written above<br>
      <br>
      <br>
      <br>
      I hope you can learn a little from my gibberish.<br>
      Thank you all<br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Am 23.11.2020 um 15:24 schrieb Jorge
      Gustavo Rocha:<br>
    </div>
    <blockquote type="cite"
      cite="mid:c1f018ef-487c-9a1c-7492-c10c2abae875@geomaster.pt">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Hi Mike,</p>
      <p>Just create an action with something like this to see it in
        action:</p>
      <p><a class="moz-txt-link-freetext"
          href="https://www.google.pt/maps/@" moz-do-not-send="true">https://www.google.pt/maps/@</a>[%
        @click_x %],[% @click_y %]</p>
      <p>This will open google maps at the place you clicked. If you
        want to get something from the action called, you have to
        capture its output (and return the right value from your
        script).<br>
      </p>
      <p>As Richard said, start with the default actions and you will
        see different kinds of things that can be done with actions.
        Capturing the clicked X,Y is straight forward.</p>
      <p>Jorge<br>
      </p>
      <div class="moz-cite-prefix">Às 13:22 de 23/11/20, Mike Flannigan
        escreveu:<br>
      </div>
      <blockquote type="cite"
        cite="mid:5b0ce5d6-9002-2810-cd10-bd58b61b79ec@mflan.com"> <br>
        On 10/26/2014 I asked my first question in this forum: <br>
        <br>
        Coordinate Capture plugin allows one to click on the map, hit <br>
        the "Copy to clipboard" button, and then use the lat/long on <br>
        the clipboard. I want something similar, but I want to <br>
        skip the "Copy to clipboard" button. Ideally I want to <br>
        click on the map and it copies the lat/long to the clipboard, <br>
        executes an external script, and puts the result on the map <br>
        next to the place clicked. I can skip the last step if that <br>
        is too complicated. <br>
        <br>
        Can that be done with "Actions"? Or is the Python Console or <br>
        some other means a better way to get this done? <br>
        <br>
        <br>
        <br>
        It went unanswered and I have never found a way to execute a <br>
        script upon a click.  I've seen others who wanted actions based
        <br>
        on a click or hover, but no clear solutions presented.  It
        sounds <br>
        like you are on to something below. <br>
        <br>
        <br>
        Mike <br>
        <br>
        <br>
        On 11/23/20 5:24 AM, <a class="moz-txt-link-abbreviated"
          href="mailto:qgis-user-request@lists.osgeo.org"
          moz-do-not-send="true">qgis-user-request@lists.osgeo.org</a>
        wrote: <br>
        <blockquote type="cite">I tried a little bit with "actions" but
          - I think you're right - there <br>
          is no onHover. <br>
          <br>
          anyway, I found a much more comfortable solution for the
          moment. <br>
          <br>
          I add the simple term "OR is_selected()" in the if clause for
          my symbol <br>
          to show the changed color (in my case I draw a line between
          two points) <br>
          and it worked like a charme. <br>
          <br>
          But, this is without the option to e.g. display a messagebox
          or someting <br>
          like that with additional informations of the feature (I know
          about map <br>
          hints/tips (I do not know the right translation). <br>
          <br>
          Yes you could made an action for that, but my goal was to show
          this on <br>
          hover, but click is oooookay. <br>
          <br>
          For X-Mas my wish in relation to QGIS is a hover event ... on
          feature on <br>
          map and on symbols.;-) <br>
          <br>
          Thanks for helping to everyone. <br>
          <br>
        </blockquote>
        <br>
        <br>
        _______________________________________________ <br>
        Qgis-user mailing list <br>
        <a class="moz-txt-link-abbreviated"
          href="mailto:Qgis-user@lists.osgeo.org" moz-do-not-send="true">Qgis-user@lists.osgeo.org</a>
        <br>
        List info: <a class="moz-txt-link-freetext"
          href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
          moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
        <br>
        Unsubscribe: <a class="moz-txt-link-freetext"
          href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
          moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
        <br>
      </blockquote>
      <div class="moz-signature">-- <br>
        <title>Email Signature</title>
        <meta content="text/html; charset=UTF-8"
          http-equiv="Content-Type">
        <table style="width: 525px; font-size: 11pt; font-family: Arial,
          sans-serif;" cellspacing="0" cellpadding="0">
          <tbody>
            <tr>
              <td style="text-align:center; font-size: 10pt;
                font-family: Arial, sans-serif; border-right: 1px solid;
                border-right-color: #fb6303; width: 125px;
                padding-right: 10px; vertical-align: top;" rowspan="6"
                width="125" valign="top"> <a
                  href="https://www.geomaster.pt" target="_blank"
                  moz-do-not-send="true"><img alt="Logo"
                    style="width:105px; height:auto; border:0;"
src="https://geomaster.pt/wp-content/uploads/2017/02/cropped-geomaster300x300-1.png"
                    moz-do-not-send="true" width="85" border="0"></a> </td>
              <td style="padding-left:10px">
                <table cellspacing="0" cellpadding="0">
                  <tbody>
                    <tr>
                      <td style="font-size: 10pt; color:#0079ac;
                        font-family: Arial, sans-serif; width: 400px;
                        padding-bottom: 5px; padding-left: 10px;
                        vertical-align: top;" valign="top"> <strong><span
                            style="font-size: 14pt; font-family: Arial,
                            sans-serif; color:#fb6303;">Geomaster</span></strong><br>
                        <strong><span style="font-size: 11pt;
                            font-family: Arial, sans-serif;
                            color:black;">Jorge Gustavo Rocha</span></strong>
                        <span style="font-family: Arial, sans-serif;
                          font-size:11pt; color:#000000;"><span
                            style="padding-right: 5px; padding-left:
                            5px;"> | </span>Software Engineer</span> </td>
                    </tr>
                    <tr>
                      <td style="font-size: 10pt; color:#444444;
                        font-family: Arial, sans-serif; padding-bottom:
                        5px; padding-top: 5px; padding-left: 10px;
                        vertical-align: top; line-height:17px;"
                        valign="top"> <span><span style="color:
                            #fb6303;"><strong>e:</strong></span><span
                            style="font-size: 10pt; font-family: Arial,
                            sans-serif; color:#000000;"> <a
                              class="moz-txt-link-abbreviated"
                              href="mailto:jgr@geomaster.pt"
                              moz-do-not-send="true">jgr@geomaster.pt</a></span></span>
                        <span><span style="padding-left:
                            5px;padding-right: 5px;"> | </span><span
                            style="color: #fb6303;"><strong>m:</strong></span><span
                            style="font-size: 10pt; font-family: Arial,
                            sans-serif; color:#000000;"> +351 910 333
                            888<br>
                          </span></span> <span><span style="color:
                            #fb6303;"><strong>g:</strong></span><span
                            style="font-size: 10pt; font-family: Arial,
                            sans-serif; color:#000000;">
                            41.54094,-8.40490</span></span> <span><span
                            style="padding-left: 7px;padding-right:
                            5px;"> | </span><span style="color:
                            #fb6303;"><strong>v: </strong></span><span
                            style="font-size: 10pt; font-family: Arial,
                            sans-serif; color:#000000; padding-left:
                            7px;"> 510 906 109<br>
                          </span></span> <span> <span style="color:
                            #fb6303;"><strong>a: </strong></span> </span>
                        <span> <span style="font-size: 10pt;
                            font-family: Arial, sans-serif; color:
                            #000000;"><span> </span>Rua António Cândido
                            Pinto, 67, 4715-400 Braga<br>
                          </span></span> </td>
                    </tr>
                  </tbody>
                </table>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
    </blockquote>
  </body>
</html>