[Qgis-user] Set variables by UI

Stefan Giese (WhereGroup) stefan.giese at wheregroup.com
Wed Nov 25 22:05:32 PST 2020


you can use one of the signals emitted by a QgsVectorLayer, for example 
|attributeAdded| 
<https://qgis.org/pyqgis/3.14/core/QgsVectorLayer.html?highlight=qgsvectorlayer#qgis.core.QgsVectorLayer.attributeAdded> 
or |afterCommitChanges| 
<https://qgis.org/pyqgis/3.14/core/QgsVectorLayer.html?highlight=qgsvectorlayer#qgis.core.QgsVectorLayer.afterCommitChanges> 
(see https://qgis.org/pyqgis/3.14/core/QgsVectorLayer.html) for the 
whole list of signals. Then you will need a python script to connect a 
slot (function) to that signal doing what you wanted to be done with 
your layer(s). at least you will need a place where to put your function 
in and connect it to the signal, this can be done manual from the 
console or you can put in the open project macro or in a 
startup.py...this depends what you want to achieve. I described  a bit 
different example in this post on stackexchange: 
https://gis.stackexchange.com/questions/379781/forcing-choice-for-default-value-during-data-entry/379827#379827 
but it will show you, how you can start with signals and slots.

hope this helps a bit

Stefan

Am 25.11.2020 um 22:43 schrieb L.W.:
>
> That's what I want to use, but how to set the "default value" - no, 
> not per propertier and form builder.
>
> I want to set the DV by input in "UI A" (add feature to layer A) and 
> then add new feature to B, and in UI B the DV is set to value from form A.
>
>
> Am 25.11.2020 um 21:19 schrieb Harrissou:
>> Hi,
>> Something like setting default values for field: 
>> https://docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/vector_properties.html#default-values 
>> <https://docs.qgis.org/3.16/en/docs/user_manual/working_with_vector/vector_properties.html#default-values> 
>> ?
>>
>> Regards,
>> Harrissou
>>
>> Le 25 novembre 2020 20:49:17 GMT+01:00, "L.W." <eaglelw at gmx.de> a 
>> écrit :
>>
>>     Hello,
>>
>>     I have a question again, I know the possibility of the project
>>     variables, which can be queried from all layers.
>>     I have to insert several points and lines or polygons in different layers.
>>     All inserted features have in common that they have certain attributes
>>     that are the same for all.
>>     It would be nice if I only have to enter these common attributes for the
>>     first feature and the values ​​are then automatically inserted as
>>     default values ​​for each new feature.
>>     One possible way would of course be a link to a shared data table, but I
>>     don't necessarily want to go this way for reasons.
>>     I know the option of giving a UI a Python script when it is opened (even
>>     if I can't Python), but I haven't found anything to execute a script
>>     after closing, for example.
>>     Obviously logical, you can of course set the variables beforehand, but
>>     that would be another step that you have to take beforehand and you
>>     cannot get to these variables without a whole series of mouse clicks.
>>
>>     Any ideas?
>>
>>     Regards
>>     ------------------------------------------------------------------------
>>     Qgis-user mailing list
>>     Qgis-user at lists.osgeo.org
>>     List info:https://lists.osgeo.org/mailman/listinfo/qgis-user  <https://lists.osgeo.org/mailman/listinfo/qgis-user>
>>     Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user  <https://lists.osgeo.org/mailman/listinfo/qgis-user>
>>
>>
>> -- 
>> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez 
>> excuser ma brièveté. 
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
Mit freundlichen Grüßen
Stefan Giese
Projektleiter/Consultant
------------------------------------------------------
Aufwind durch Wissen!
Jetzt neu: Webinare und Online-Schulungen
bei der www.foss-academy.com
------------------------------------------------------

WhereGroup GmbH
Schwimmbadstr. 2
79100 Freiburg
Germany

Fon: +49 (0)761 / 519 102 - 61
Fax: +49 (0)761 / 519 102 - 11

stefan.giese at wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20201126/7074ea4f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20201126/7074ea4f/attachment.sig>


More information about the Qgis-user mailing list