Re: [QGIS-Developer] QgsGeometryUtils.lineCircleIntersection

2023-02-13 Thread Andrea Giudiceandrea via QGIS-Developer

Hi Antonio,

Il 13/02/2023 15:46, Antonio Locandro via QGIS-Developer ha scritto:
I am trying to use this on a script I am writing however I can’t seem 
to get what the syntax for the Qgs Vector should be, I was expecting 
just to put directly an angle but it is something else.


QgsVector(x: float, y: float)
See https://qgis.org/pyqgis/3.28/core/QgsVector.html#qgis.core.QgsVector


On the other hand in order to use this function I need to write 
completely QgsGeometryUtils.lineCircleIntersection is there a way to 
make this shorter on my script?


lineCircleIntersection = QgsGeometryUtils.lineCircleIntersection


Finally why some functions require QgsPointXY while others QgsPoint, 
beats me, just above this one is lineCircleIntersection that requires 
the use of PointXY


Probably because functions that use QgsPointXY only support 2D calculation.


Best regards.

Andrea Giudiceandrea___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


[QGIS-Developer] QgsGeometryUtils.lineCircleIntersection

2023-02-13 Thread Antonio Locandro via QGIS-Developer
Hello all,

I am trying to use this on a script I am writing however I can’t seem to get 
what the syntax for the Qgs Vector should be, I was expecting just to put 
directly an angle but it is something else.

lineIntersection(p1: QgsPoint, v1: QgsVector, p2: QgsPoint, v2: QgsVector) → 
Tuple[bool, QgsPoint]

On the other hand in order to use this function I need to write completely 
QgsGeometryUtils.lineCircleIntersection is there a way to make this shorter on 
my script?

Finally why some functions require QgsPointXY while others QgsPoint, beats me, 
just above this one is lineCircleIntersection that requires the use of PointXY.

My current workaround is to use segmentIntersection but that requires the 
calculation of dummy points so was looking for something more direct
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [QGIS-Developer] PyQGIS code: setting filter expression for value relation widget

2023-02-13 Thread Andreas Neumann via QGIS-Developer

Hi,

I found the "QgsValueRelationSearchWidgetWrapper" class, which seems to 
have a "setExpression" method - but I don't know how I can access and 
change the QgsValueRelationSearchWidgetWrapper of an existing ComboBox 
in the attribute form.


Andreas

On 2023-02-13 11:31, Andreas Neumann via QGIS-Developer wrote:


Hi,

I am looking for a code snippet in PyQGIS: how can I change the filter 
expression for a value relation widget?


Technically, the widget seems to be a QComboBox. I can get access to 
the combobox, e.g. to get the current value - but how can I access the 
QGIS related functionality, like changing programmatically settings of 
the value relation widget , such as the filter expression? I found the 
QgsValueRelationFieldFormatter object, but it doesn't allow me to 
change the filter expression. Any idea how I would change the filter 
expression using Python?


Thank you for any hints,

Andreas
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


[QGIS-Developer] PyQGIS code: setting filter expression for value relation widget

2023-02-13 Thread Andreas Neumann via QGIS-Developer

Hi,

I am looking for a code snippet in PyQGIS: how can I change the filter 
expression for a value relation widget?


Technically, the widget seems to be a QComboBox. I can get access to the 
combobox, e.g. to get the current value - but how can I access the QGIS 
related functionality, like changing programmatically settings of the 
value relation widget , such as the filter expression? I found the 
QgsValueRelationFieldFormatter object, but it doesn't allow me to change 
the filter expression. Any idea how I would change the filter expression 
using Python?


Thank you for any hints,

Andreas___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer