Questions tagged [pyqt5]
Python bindings for Qt5
56
questions with no upvoted or accepted answers
7
votes
0
answers
953
views
QGIS 3: Set custom project variables with input dialog
I am using QGIS 3.10.0 and Windows 10. I have a project where I want the user to define custom project variables. I want to make this user friendly, I don't want the user to need to open the project ...
6
votes
0
answers
730
views
QGIS 3 Value Relation current_value() not working in custom ui form
I have a custom UI form made with Qt Designer with a couple of dropdown list, so I can easily edit a layer. I use a Value Relation on those fields to filter the displayed data. The problem is the ...
5
votes
0
answers
133
views
PyQGIS: What objects need to be destroyed in a custom expression
I'm using a custom (PyQGIS) function in expressions to make little detailed minimaps around each feature in a layer, and store it in the layer (gpkg) as a png.
My code works but makes QGIS (3.12) ...
4
votes
0
answers
79
views
Restore default signals to QgsVectorLayer using PyQGIS
I have a connected a function to the QgsVectorLayer.selectionChanged signal of one of my layers.
For the sake of simplicity let's assume it is a simple print statement:
def print_confirmation():
...
3
votes
0
answers
118
views
Finding center point of opened QGIS application using PyQt
How can I find the center point of the opened QGIS application by means of PyQt?
By center point I mean this red cross in the middle of my screen where I have opened QGIS, see the image below.
I ...
3
votes
0
answers
186
views
Error with PyScripter and QGIS 3.22, can't find DLL
Since using the new installer for the x64 only version OSGeo4W/QGIS (new 3.22 LTR), I can't no longer use PyScripter with the bundled PyQt5. When I try to import QSettings for example, PyScripter can'...
2
votes
0
answers
26
views
How to capture featureDeleted() info in PyQGIS3
I have a system of scratch layers generated from table data in QGIS. Users may interact with the attribute tables directly (not good practice, but I did not design the system) or through a PyQt5 UI. ...
2
votes
1
answer
254
views
Importing QtWidegets, uic from PyQt5 in an OSGeo python environment
In PyCharm I have a python environment setup with a Bat file so that I can use QGIS and OSGeo python environment in my scripts. I started looking into ui's and using this code
from PyQt5 import ...
2
votes
0
answers
279
views
QGIS custom form : mixing Qt Widgets and QtQuick QML Widgets
On QGIS 3.16 I am trying to create a custom form with some Python logic for feature navigation and a QML widget to display nicely images.
I embedded my QtQuick QML file in the custom form python file ...
2
votes
0
answers
982
views
How to keep PyQt GUI alive while doing heavy calculation and updating Progress bar and logger
I have a GUI designed with PyQt, this GUI has a progress bar and a logger.
when the user clicks the Run button the GUI/QGIS will become "No responding"
the actions normally take 45minutes to ...
2
votes
0
answers
203
views
Connect QgsMapTool to PyQt Application
I am trying to initialise my DrawPolygonMapTool within my application once the DrawPolygonButton is enabled. When the relevant button is pushed, it does run the __init__ function in my ...
2
votes
0
answers
104
views
Delayed function calling inside QgsTask
I try to add a function to the qt event loop via QTimer.singleShot(...) from within a QgsTask. However the function is never executed. I wrote a short script that isolates this issue:
import time
...
2
votes
0
answers
176
views
Convert QDialog Plugin to QDockWidget
I have a QGIS 3 plugin that is in QDialog. Everything is functional but i want to change it to QDockWidget and dock it within QGIS. How can i convert it to QDockWidget?
I am using QGIS 3 with Pyqt5. ...
2
votes
0
answers
50
views
How to merge polygons to get coordinates of final shape?
I have list of plots numbers that should be merged into multipolygon. As a result I have to get coordinates of final shape (as multipolygon).
That is may code:
# work only on layer "plots"
name = ...
1
vote
0
answers
84
views
QGIS 3.x Python - Some VectorLayer signals not working?
I'm writing a plugin and was really hoping to get the featureAdded signal when the user is interacting with a VectorLayer object in the plugin, but I never see that signal. To try and figure out what'...
1
vote
0
answers
54
views
Publishing QGIS Plugin without giving access to API keys that the plugin relies on
I am building a plugin that requires an API key that I would not like to be shared publicly.
Is there anyway that I can do this?
I am new to QGIS but I know you have to publish your code.
1
vote
0
answers
118
views
Set QComboBox to disabled on form load based on feature attribute value
I am trying to display a QGIS 3 custom form combobox (QComboxBox) as disabled/greyed-out on initial form load based on an attribute value. The custom form was created with Qt Designer 5.15.2.
I can ...
1
vote
0
answers
43
views
Accessing scene item list without crashing QGIS?
Temporary graphics items can be added to the canvas, e.g with.
canvas = iface.mapCanvas()
point = QgsPointXY(10, 55)
vm = QgsVertexMarker(canvas)
vm.setCenter(point)
and can be removed by using iface....
1
vote
0
answers
471
views
Convert .ui GUI file to python with QGIS Plugin Builder
I am using the QGIS plugin builder 3 with Qt Designer to create the GUI for my plugin. I've got a basic GUI done with QtDesigner and I need to dynamically populate a container in my GUI using python. ...
1
vote
0
answers
567
views
PyCharm with pytest run configuration fail importerror PyQt5 with pipenv
I have difficulties setting up PyCharm to run my tests correctly while using a pipenv interpreter
if i run my tests through a terminal with
pipenv run pytest
it works perfectly because it loads the ....
1
vote
0
answers
579
views
Folium map not updating when adding Tooltip attribute in PyQt GUI
I am trying to create a geospatial Python GUI app using PyQT5, Geopandas, OSMnX, and Folium. I am converting the app into an .EXE file using pyinstaller. The app looks something like this:
I am using ...
1
vote
0
answers
235
views
Make sure only one PyQt window is shown
I am developing a plugin for QGIS 3.10.
In part of my plugin, I have a UI using PyQt.
This form needs to be a singleton.
But when I have click several times on the plugin it generates several forms
...
1
vote
0
answers
51
views
ProgressBar for a function that has to communicate with QObjects
My Plugin uploads Layers to a WebGIS and the QGIS GUI turns inactive during this process. So that the User knows that the Program hasn't crashed I want to implement a ProgressBar.
My first try gave me ...
1
vote
0
answers
150
views
Install the 5.11.2 version of PyQt5 using OSGeo4W setup
How can I install the 5.11.2 version of PyQt5 using the OSGeo4W setup in Windows10? The default version of PyQt5 installed from OSGeo4W is 5.11.3 which is different from the QGIS compilation version, ...
1
vote
1
answer
1k
views
I can't load a CSV file inside a QTableWidget by Python code
I am a beginner of PyQGIS and I'm trying to do a QGIS plugin, with QGIS 3.4.7 and PyCharm 2016.3.6. I already did the "dialog" box on Qt and after I wrote on Pycharm. It is a table only with ...
1
vote
0
answers
169
views
How to use nested for loop to iterate over features of a layer?
I have a shapefile having features with duplicate IDs. I want to merge features with same IDs and take average of values of other field which are different. How is it possible in python in QGIS3?
...
1
vote
0
answers
162
views
how to access Canvas mouse point on action of button from another window Pyqt5
I am PyQt5 and PyQgis novice. Below code snippet is my main window application. Below code throw a main Window with QGsMapCanvas as central widget as canvas, which displays maps.
On menu action and i ...
1
vote
0
answers
375
views
How to fill a field with comboBox.currentText()
Basically, I want to create a widget plugin (QGIS 3.x) in which any user can choose a standard text from a combo box and, after press a ok button, enable a layer for editing and calls the add feature ...
1
vote
0
answers
51
views
Getting HTML-Values in a QGIS-form by pyQT5
I have created a form for point-objects, that is delivering some values (getting by a database-connection) in the "html-area" in the form.
So far the form works well and I´m getting the values that I ...
1
vote
0
answers
69
views
How to pull in and push out text browser?
I am using Qt designer to create a plugin in Qgis3. I want to add description of a tool beside the tool. For this I have tried using 'Text Browser' by connecting it with button. I am able to hide and ...
1
vote
0
answers
163
views
PyQGIS (3.4) and PyQt5 DLL error
I have installed the new version os QGIS(3.4) on my computer. I am working in a standalone application of PyQGIS so I need to load PyQt5 components. As a difference with previous versions when I try ...
1
vote
0
answers
51
views
QGIS (maptool) Plugin Crashes on some computers
I developed a custom Plugin which inherits from QGIS MapTool.The plugin has user interfaces and can add features to the map based on a GUI. The Plugin works Fine on some computer(when they installed ...
1
vote
0
answers
714
views
Custom Attributes form in QGIS 3
I'm trying to customize feature form with ui file, I followed https://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/1 but the attributes values still null when I added ...
1
vote
0
answers
1k
views
Use PyQtGraph by using QtDesigner
I want to create and display a graph on Main Window which I designed in QtDesigner. These plot graph values are taken from table widget, it is not problem. Main problem is here, what I use to show the ...
1
vote
0
answers
371
views
QGIS3 error Python on launch, Ubuntu 16.4
I installed QGIS3 on ubuntu 16.4.
When I launch QGIS I get an error:
Impossible de charger PyQt. (Can't load PyQt)
Le support Python va être désactivé. (Python support will be deactivate)
...
1
vote
0
answers
1k
views
How to create a dialog built in Qt Designer from a QGIS dockwidget
I am building my first python QGIS plugin, which all I want to do is to have a dockwidget that can instantiate a dialog box which I built using qt designer. I built a simple dialog box inside qt ...
0
votes
0
answers
37
views
Update ui progress bar from calculation class (pyqt5)
I have 2 classes :
first class : a "processing class" running some calculation;
second class : a "ui" class that displays a progress bar and a label.
The goal is, as the ...
0
votes
0
answers
23
views
Replace Attributes Form and Automate Fields
I used QT Creator to create an .ui for my form.
I want to change the form attribute and automate some fields. Imagine I have an layer with field name, I want that field when the form appears, to ...
0
votes
0
answers
20
views
Create standalone EXE PyQGIS application
Has anyone managed to create a separate PyQGIS exe application?
Versions: QGIS 3.22 or 3.28, Python 3.9, IDE PyCharm 2022.2
I've already tried almost everything, including the instructions from this ...
0
votes
0
answers
66
views
After adding the line "from qgis.core import QgsApplication", the exe application does not work
I am testing a simple PyQGIS application. When I add the line "from qgis.core import QgsApplication" and make an exe via pyinstaller, the application crashes with an error:
Traceback (most ...
0
votes
0
answers
29
views
QGIS 3.10 PyQGIS . Snapping tolerance units (Equivalence pixels - length units)
Lately I have been dealing with snappings in QGIS. I have been able, with help of people from this site, and also, having a look at other peoples plugins, to ensemble a small plugin with forms.
My ...
0
votes
0
answers
74
views
How to embed hyperspectral image in Qlabel using PyQt5 in Python?
I have used Qpixmap for embedding a normal image in Qlabel in user interface and its working totally fine but when I'm trying to embed a hyperspectral image its showing error.
Following is the code ...
0
votes
0
answers
203
views
cannot import name 'sip' from 'PyQt5'
I am trying to download GTT (game terrain tools) plugin for QGIS, but I am getting this error
ImportError: cannot import name 'sip' from 'PyQt5' (C:\PROGRA~2\QGIS3~1.16\apps\Python37\lib\site-packages\...
0
votes
0
answers
295
views
PostgreSQL error 42601 when trying to access stored procedure with prepared query from PyQt5 using QPSQL driver
I'm trying to use PostGIS as a backend for a QGIS system. I Just started with PostgreSQL and run into difficulties running a store procedure from a PyQt5 client using (this time) the QPSQL driver. I ...
0
votes
0
answers
59
views
Calling procedure from PyQt5 using psycopg2 driver PostgreSQL Error 2D000 Invalid transaction termination
I'm trying to use PostGIS as a backend for a QGIS system. I started with PostgreSQL recently and I'm running into trouble calling a procedure from a PyQt5 client using the psycopg2 driver.
I set a ...
0
votes
0
answers
33
views
QgsDockWidget content gets "squashed"
I designed QgsDockWidget in QtDesigner and it looks like this:
But when the plugin is started all the content gets messed up:
What can be the possible reason for such behavior? I set minimumSize ...
0
votes
0
answers
108
views
Unable to import QGIS algorithms in a virtual environment
I am trying to run QGIS processing algorithms in a standalone Python script (in a virtual environment). I adjusted the path variables so that Python from QGIS will be accessed first instead of Python ...
0
votes
0
answers
36
views
Plug-in to reshape sharp edges to circular string is not working near to start/end point of polygon
I am developing a plug-in in QGIS. By using two points I am creating a circular string to reshape sharp polygon edges to round. The plugin is reshaping 3 edges perfectly but failing reshaping near ...
0
votes
0
answers
619
views
How to populate QTableView/QTableWidget with attribute table of a layer using PyQIS?
I am developing a a plugin in QGIS. I want to add attribute table of a vector layer as data model in QTableView. I am using following lines of code but it is adding empty column.
...
0
votes
0
answers
1k
views
Saving map in folder for further use
I want to use my map for further offline calculations. I used the below code referred from ' https://gis.stackexchange.com/questions/313382/click-event-on-maps-with-folium-and-information-retrieval/...