Questions tagged [pyqt5]

Python bindings for Qt5

Filter by
Sorted by
Tagged with
0 votes
0 answers
21 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 ...
  • 1
0 votes
1 answer
33 views

Error when importing another py and ui files in my QGIS plugin

I am currently trying to create a QGIS plugin with several windows, and it fails. Here is what I did : With QGIS tool Plugin Builder, I created a plugin my_test This generated a folder with the 3 ...
0 votes
0 answers
20 views

how to write add-in in arcgis pro with python [duplicate]

I want to develop add-ins with python (arcpy) in arcgis pro. I searched a little but I couldn't find many examples. There was also an editor in arcmap that we used when developing add-ins. I couldn't ...
0 votes
0 answers
23 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 ...
  • 513
2 votes
0 answers
25 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. ...
  • 449
3 votes
0 answers
103 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 ...
  • 27.9k
2 votes
2 answers
241 views

Counting seconds using QTimer in PyQGIS [closed]

I am having a hard time counting seconds in PyQGIS using QTimer. The current code waits for 1 second and prints 5 times "1" as output. I desire that after every second the output should be ...
4 votes
0 answers
65 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(): ...
  • 11.5k
0 votes
0 answers
71 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 ...
2 votes
1 answer
192 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 ...
  • 1,353
0 votes
0 answers
141 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
1 answer
186 views

Setting the alpha channel value of the colour of selected features using PyQGIS

I want to be able to set the value of the alpha channel of the selected features' colors in order to see what's under those features. This thread gives a good answer to set the color of the selected ...
  • 9,081
0 votes
0 answers
215 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 ...
  • 243
0 votes
0 answers
45 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 ...
  • 243
3 votes
1 answer
123 views

Connect QgsMapLayerComboBox to QgsFieldComboBox and get text inputs

I've used the Plugin Builder tool to create the template python code. In QT Designer I have added a QgsMapLayerComboBox and QgsFieldComboBox I have gone through a couple of tutorials and checked the ...
  • 7,894
1 vote
1 answer
123 views

AttributeError converting Python function from SQLite DB to use geopackage in PyQGIS

I would like to change my functions in PyQGIS from SQLite databases to Geopackages. However, the SQL statements don't quite work as I had hoped. My table has the columns: task, completed, date With ...
  • 561
0 votes
0 answers
30 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 ...
  • 564
2 votes
1 answer
94 views

Docking QGIS Plugin

How to dock QGIS plugin window? I am trying self.iface.addDockWidget(Qt.RightDockWidgetArea, dlg) in run method of QGIS Plugin Implementation class, but the dialog keeps appearing as a floating ...
  • 564
1 vote
1 answer
170 views

Saving temporary vector layer after adding into group using PyQGIS

This code is not displaying any feature in QGIS , so I want to save the temporary layer so that the features can be visible. extract1 = processing.run("native:extractbylocation", { 'INPUT': ...
0 votes
0 answers
92 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
32 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 ...
3 votes
1 answer
578 views

PyQT progress bar freezing

I create a progress bar using the code below on the QGIS console. However, the bar freezes in the beginning, doesn't increase at all, and suddenly appears as 100% in the end. What could be the reason ...
  • 137
1 vote
0 answers
73 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'...
2 votes
1 answer
91 views

Making imports explicit in PyQGIS and PyQt

There is a QGIS plugin based on the PyQGIS/PyQt code with some imports defined in the beginning: from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * from qgis.core ...
  • 27.9k
1 vote
0 answers
48 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.
  • 11
1 vote
0 answers
96 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 ...
  • 2,200
3 votes
0 answers
180 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'...
0 votes
0 answers
603 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. ...
3 votes
1 answer
439 views

How to show the attribute table inside the dialogue of a custom plugin with QGIS

I need to create a custom table attribute inside a plugin where I can choose which layer I need to open and add new custom buttons to this custom table attribute To become like this :
  • 31
1 vote
0 answers
41 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....
  • 162
1 vote
1 answer
166 views

PyQGIS: Querying PostGIS Table

I am trying to run a query on a PostGIS table via PyQGIS (QGIS3.16-Hannover installed on an Ubuntu 20.04LTS Desktop). Everything works fine if I SELECT ALL FIELDS using the wildcard pattern (*) ...
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/...
  • 1
0 votes
1 answer
69 views

In a QGIS plugin, how to let user click on canvas multiple times and store coordinates of all the points in a single list?

I am trying to get a list of coordinates for 3 different points in a single list. I am able to make a list of coordinates of a single point and then it overwrites the previous one while clicking to ...
3 votes
1 answer
1k views

Developing QGIS plugin: AttributeError: object has no attribute

I was tasked with making a small plugin for QGIS or add a small functionality to an existing one. What I am trying to do is take the "geocode with web service" from the plugin MMQGIS and add ...
4 votes
1 answer
243 views

QgsFileWidget mandatory field in QWizard issue

I'm trying to create a mandatory QgsFileWidget in a QWizard form for a plugin but the result is a Next button that doesn't get active when I choose the path to save the project. Here is the snippet of ...
2 votes
1 answer
88 views

Push button execution not returning any messages in the log

I need to work with some layers and provide output in the form of an Excel file. I have applied a push button in my QT tool design. I have also defined function which is supposed to work after I press ...
1 vote
0 answers
408 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. ...
  • 51
1 vote
1 answer
256 views

Using pyqtSignal in emitting signal for maptool in QGIS

For QGIS I have a plugin named GGAImporter: from .point_tool import PointTool class GGAImporter: ... def addFachdatum(self): self.mapTool = PointTool(self.iface.mapCanvas()) self....
  • 1,161
3 votes
1 answer
291 views

Getting point geometry by clicking at the map within QGIS plugin

From QGIS 3 Plugin Tutorial I need the example for getting a point geometry from clicking at the map. So I have a file point_tool.py: from qgis.gui import QgsMapTool, QgsMapToolEmitPoint from PyQt5....
  • 1,161
1 vote
1 answer
2k views

QTableWidget hoizontalHeaderItem is returning None

I am developing a tool is Qgis3 using PyQt5. I am adding columns using a button and the setting column names using 'setHorizontalHeaderItem'. But it gives None while trying to read it. Following is ...
1 vote
1 answer
130 views

Displaying QgsMessageBar from plugin

As suggested in docs, the QGIS message bar is usually the best option to show short messages communicating with the user. Is it possible to show the QGIS message bar inside a plugin's GUI developed ...
  • 69
1 vote
0 answers
515 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
499 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 ...
0 votes
0 answers
179 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 ...
  • 1
3 votes
1 answer
216 views

Efficient filtering of many options in QGIS Plugin

Using PyQGIS, I am developing a QGIS plugin that includes a filter function. It should make handling easier for users (internal) who rarely use QGIS. Now I have created a interface with the QT ...
2 votes
1 answer
473 views

Dynamic parameters in Qt Designer

Started building my first plugin in qgis and looking for a way to create dynamic widget in pyqyt and Qt designer which allow user to add or delete parameters as much as he want (something like a '+' ...
0 votes
0 answers
70 views

QGIS - win32api

I would like to send a docx file to a printer. So, with the win32api, "normally" it should works (QGIS 3.10). In a python plugin, i try to import the win32api import win32api ImportError: ...
  • 493
7 votes
1 answer
182 views

GIF freezes when QGIS plugin runs

I have a QGIS plugin and would like to put loading GIF (spinner) somewhere in the Dialog Window. The problem is when I run the spinner with the following code and call next function, the spinner ...
0 votes
1 answer
131 views

Open a new map view with PyQGIS [closed]

I'd like to use PyQGIS to open a new map view with its own map canvas & coordinate system. This seems like a very basic questions but I can't find any information about it! I suppose I can somehow ...
  • 516
1 vote
1 answer
259 views

qgis.pyQt5 button role returns different values on definition and button activation

The Goal is to implement 3 Buttons in pyQt5. The returned Values differ from the defined roles values. The returned values seem to depend on the order, the buttons are added. What is happening here? ...