Questions tagged [pyqt5]

Python bindings for Qt5

Filter by
Sorted by
Tagged with
4 votes
0 answers
48 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(): ...
  • 8,775
0 votes
0 answers
33 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
45 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,333
0 votes
0 answers
44 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
67 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 ...
  • 7,530
0 votes
0 answers
63 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
28 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
77 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,838
1 vote
1 answer
51 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 ...
  • 531
0 votes
0 answers
29 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 ...
  • 514
2 votes
1 answer
68 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 ...
  • 514
0 votes
1 answer
127 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
72 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
445 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 ...
  • 127
1 vote
0 answers
53 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'...
0 votes
0 answers
45 views

Extract value from raster layer according circular buffer from vector layer ,Anaconda [closed]

I have 2 layers raster and vector , vector is have one value coordinate , i try to read it and create buffer of 5 km , i did it and save the new buffer as polygon .shp file format, but the problem is ...
2 votes
1 answer
75 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 ...
  • 25.8k
1 vote
0 answers
43 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
66 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,160
3 votes
0 answers
157 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
554 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
335 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
0 votes
0 answers
33 views

Failed to build QGIS from source. PyQt5

During the configuration, I got: ModuleNotFoundError: No module named 'PyQt5.Qsci' When I tried to build QGis, I got: [ 76%] Updating appinfo files... cd ....../QGIS && /usr/bin/python3.8 .......
  • 101
1 vote
0 answers
40 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
126 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
804 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
51 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
786 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
187 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
66 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
246 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
156 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,146
3 votes
1 answer
218 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,146
1 vote
1 answer
1k 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
88 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
444 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
375 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
167 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
184 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
389 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
59 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
169 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
100 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
182 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? ...
1 vote
1 answer
233 views

How to Access QSettings() of QGIS from outside QGIS Console

How can we access all the keys under QSettings() of QGIS 3.4 and above? Requirement is such that we need to set some QSettings() keys for smooth working of developed Plugins from outside of QGIS. But ...
2 votes
0 answers
208 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 ...
  • 83
1 vote
1 answer
157 views

Hiding specific layer using QCheckBox widget (PyQt5/PyQGIS)

I have a custom PyQGIS application that loads weather data on a basemap. Upon selecting an analysis type, the application loads a raster layer containing a colormap and two vector layers that contain ...
0 votes
1 answer
107 views

Zooming to feature selected from QListWidget using PyQGIS

I have displayed in a QListWidget several features ranked according to their values from a field named "CODE". Based on this list I would like to select a feature and after a click on a ...
  • 1,674
4 votes
1 answer
233 views

Export theme and its associated layers in xml file in PyQGIS

I was trying to export all themes and its corresponding layers information through PyQGIS so that xml can be read later .There is method in Class: QgsMapThemeCollection, writeXml(self, doc: ...