Skip to main content

Questions tagged [pyqt5]

Python bindings for Qt5

Filter by
Sorted by
Tagged with
0 votes
1 answer
36 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 ...
Salvatore Diolosà's user avatar
0 votes
1 answer
52 views

Capture canvas mouse click in QGIS QDialogue plugin [closed]

I wrote a QGIS plugin that is a GUI, and I'm struggling to capture canvas click events. My goal: Whenever a user clicks on the canvas while my plugin is open, I want to know which maptool they were ...
Carmel Suchard's user avatar
1 vote
1 answer
44 views

Plotting ImageOverlay on Folium maps fails

I'm making a project. I need to open a local GeoTIFF file and load it into the Folium map with PyQt5. For now, instead of GeoTIFF, I took a numpy array. If it is 500,500,3 shape, everything is fine. ...
CruelBrutalMan's user avatar
0 votes
0 answers
37 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 ...
aogino's user avatar
  • 15
1 vote
1 answer
58 views

QGIS use Python script to show Hexabinning results instead of manually using Symbology

I am developing a hexabinning QGIS plugin. I have used the following script to perform hexabinning https://github.com/maphew/mhwcode/blob/1ef8338e20ff24ddbe741af225e556b9d81ec416/gis/qgis/h3-grid-from-...
sharmapn's user avatar
0 votes
1 answer
45 views

QgsFieldComboBox update/refresh after choice in QgsMapLayerComboBox

I'm trying to build QGIS plugin, using QT Designer with QGIS 3.34.2 custom widgets. It is really convenient to set up most of interface actions using signals and slots, so after choosing Layer in ...
svn's user avatar
  • 101
0 votes
1 answer
117 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 ...
Will Jackson's user avatar
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 ...
geraldo's user avatar
  • 960
0 votes
0 answers
25 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 ...
geraldo's user avatar
  • 960
1 vote
0 answers
137 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 ...
Andre Geo's user avatar
  • 656
0 votes
0 answers
98 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() ...
aurel_nc's user avatar
  • 612
0 votes
0 answers
172 views

Import QWebEngineView into PyQGIS script

I'm working on a project that should interact with Google Maps API. Usually I use QWebView as a widget to load web pages. But my simple html page is not loading there. However if I load the original ...
Pavel Pereverzev's user avatar
6 votes
1 answer
216 views

PyQt signal when layer name is changed in PyQGIS

Use this when layers are added, deleted, or their order is changed. Can you get a signal when a layer name is changed? QgsProject.instance().legendLayersAdded.connect(self.polygonList) QgsProject....
Jihyun Kim's user avatar
-1 votes
1 answer
67 views

QGIS3 quits after PyQt Script 2 run [closed]

I wrote the PyQt script below and I am running it through QGIS3. When I run it for the first time after opening it in QGIS3, the application's window pops up smoothly. However, when I close the window ...
HelpOverFlow's user avatar
3 votes
1 answer
96 views

AttributeError when creating list field with QVariant in QgsVectorLayer using PyQGIS

I am trying to create a list-type field for the active layer using the code below, which is not working. Is there any other way to create a list-type field and update the list([1,2,3]) as an attribute ...
Ganesh S's user avatar
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 ...
Kai's user avatar
  • 371
0 votes
1 answer
741 views

Pyqt5 : dynamically change label value, with no clicking signal

I have a question regarding PyQGIS. I am currently developing a plugin, and I wish to update a window's label as soon as the window opens, without having to click on a button. Here is what I do: I ...
theonewhodidnotknow's user avatar
0 votes
0 answers
62 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 ...
Stano's user avatar
  • 41
0 votes
0 answers
124 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 ...
Stano's user avatar
  • 41
0 votes
1 answer
86 views

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

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 ...
theonewhodidnotknow's user avatar
0 votes
0 answers
64 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 ...
nanunga's user avatar
  • 533
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. ...
CNIDog's user avatar
  • 479
3 votes
0 answers
159 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 ...
Taras's user avatar
  • 33.3k
3 votes
2 answers
850 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 ...
Sajeel Zafar's user avatar
4 votes
0 answers
128 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(): ...
Matt's user avatar
  • 17.6k
2 votes
1 answer
367 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 ...
MrKingsley's user avatar
  • 1,443
0 votes
1 answer
613 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 ...
swiss_knight's user avatar
  • 10.5k
3 votes
1 answer
480 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 ...
GeorgeC's user avatar
  • 8,248
1 vote
1 answer
302 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 ...
Omegon's user avatar
  • 621
3 votes
1 answer
242 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 ...
Kubson's user avatar
  • 614
1 vote
1 answer
440 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': ...
Satya Dalei's user avatar
3 votes
1 answer
1k 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 ...
Melanie's user avatar
  • 159
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'...
ArgentMage's user avatar
2 votes
1 answer
174 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 ...
Taras's user avatar
  • 33.3k
1 vote
0 answers
63 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.
caro's user avatar
  • 11
1 vote
1 answer
265 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 ...
cm1's user avatar
  • 2,290
3 votes
1 answer
259 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'...
Andreas Müller's user avatar
0 votes
0 answers
808 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. ...
vigna purohit's user avatar
3 votes
1 answer
860 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 :
lackti's user avatar
  • 31
1 vote
0 answers
54 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....
mins's user avatar
  • 257
1 vote
1 answer
300 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 (*) ...
HelpOverFlow's user avatar
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/...
Mithra's user avatar
  • 1
0 votes
1 answer
95 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 ...
vigna purohit's user avatar
3 votes
1 answer
2k 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 ...
qgisStruggler's user avatar
4 votes
1 answer
428 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 ...
Marcelo Franco Patané Júnior's user avatar
2 votes
1 answer
127 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 ...
soumik chakraborty's user avatar
1 vote
0 answers
684 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. ...
Ravindu's user avatar
  • 61
1 vote
1 answer
636 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....
Frau Schmidt's user avatar
  • 1,181
5 votes
1 answer
559 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....
Frau Schmidt's user avatar
  • 1,181
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 ...
vigna purohit's user avatar