Questions tagged [pyqt5]
Python bindings for Qt5
55
questions with no upvoted or accepted answers
7
votes
0
answers
1k
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
824
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
161
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
130
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
169
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
114
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
34
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
377
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
400
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
1k
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
230
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
1
answer
539
views
Duplicating layout with PyQGIS 3
I want a script in PyQGIS 3. For example:
This code creates a layout "2019_A4" and adds Layout Manager. I need a code to make the same in QGIS 3 using the QgsLayoutManager with the ...
2
votes
0
answers
224
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
57
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
43
views
Reuse Extent menu from processing tools
Actually I'm using QgsExtentGroupBox in my plugin and it works fine.
Now I want to make the GUI more compact and therefor I want to implement the extent menu a lot of processing tools are using:
I ...
1
vote
0
answers
165
views
Message Bar called from script shows in its own little window
I'm trying to show a message bar in the main window, reporting on the result of a processing script. However, an empty message bar appears in the main window, and the text appears in a small little ...
1
vote
1
answer
1k
views
Folder Dialog in PyQT5
I want to create a Python Plugin for QGIS 3. I used the Plugin Builder tool to create the base of the plugin. One of the functionalities I would like to implement is a Folder Dialog where one presses ...
1
vote
0
answers
113
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
66
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
56
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
699
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
787
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
860
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
324
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
52
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
199
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
187
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
183
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
467
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
61
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
91
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
176
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
56
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
740
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
2k
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
373
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
2k
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
62
views
Recalling a MainWindow from an other script on PyQGIS console
I'm writing some scripts on Python console in QGIS. I have been stuck since a lot of time because I'm not able to recall a MainWindow class object from an other script. I've created a main menu with ...
0
votes
1
answer
56
views
Running script converted from PyQtDesigner on PyQGIS
I converted a .ui file of a project built on PyQtDesigner into a file .py. In an external IDE, the code works and the dialog window shows, while on the Python console in Qgis doesn't work. Here is the ...
0
votes
0
answers
42
views
Plugin class has no attribute
I'm working on a QGIS plugin and I named my plugin class "ModelGenerator". I've added a QCheckBox (named checkBox) in Qt Designer and I saved it to the .ui file. When calling this checkBox ...
0
votes
1
answer
129
views
Can't connect with Web Map Services - problem with OpenSSL 3.0.2 Ubuntu 22.04
This problem is connected with Qt5 I believe, starting QGIS from the command line gives, amongst many other messages:
Warning: Incompatible version of OpenSSL
Warning: QSslSocket: cannot call ...
0
votes
0
answers
26
views
QgsMessageBar in Qt Creator
By default Qt Creator does show the list of QGIS Custom Widgets - but not the QgsMessageBar. I can make it work inserting it directly in the Code View using something like but really would like to ...
0
votes
0
answers
107
views
QFileDialog.getOpenFileName Loop problem in a QGis plugin
I wrote a QGIS plugin and in the pyQt5 Dialog , I use a button connected to a QFileDialog.getOpenFileName function to select a dxf file.
I aim to open the dxf file for controls.
In the def run() ...
0
votes
0
answers
70
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
141
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
70
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
819
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
2k
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/...
0
votes
0
answers
248
views
Pause the folium timestampedgeojson plugin using a PyQt button
We can play the timestampedgeojson plugin over the folium map using a PyQt button but how can we pause the folium timestampedgeojson plugin using a PyQt button in PyQt GUI and without using the plugin ...