The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [pyqt5]

Python bindings for Qt5

Filter by
Sorted by
Tagged with
2
votes
1answer
13 views

QGIS and PYQT5: Getting QgsAttributeForm.modeChanged signal

I wonder how I can catch the signal, that attributes in a form are editable? E.G. I open a form to see the values of the attributes of my geodata. Then I click on the "pencil" in QGIS (to make data ...
1
vote
0answers
13 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
1answer
26 views

QGIS ordered set from layer.getFeatures()

I need a list of all values of a certain field in a QGIS dataset. To get this, I am using for festure in layer.getFeatures(): value=feature[fieldname] This is kind of working, but I have two ...
2
votes
2answers
76 views

Ok Button disabled until every input has been filled

I'm developping a QGIS Plugin where the User clicks on the map, my plugin make a buffer and propose a street name, a street side and a disctrict, then the user selects which administration he's from ...
1
vote
1answer
65 views

QGIS plugin mouseClickEvent

I am writing a plugin which shows a graph in a qGraphicsView based on some selected points. I want to be able to read out points clicking in the graph, so I've written a mosePressEvent eventhandler ...
1
vote
1answer
38 views

Show Leaflet markers that falls inside mapbounds, based on geocode location entered from database

I have a GUI application where data from my database are displayed on a table and also displayed as markers on Leaflet map. I have added the Geocode (L.Control.geocoder()) function into my application,...
1
vote
0answers
60 views

Can't install the PyQt5 - UI to py conversion issues because of multiple python versions [closed]

I have both Python 2.7 (which comes with ArcGIS) and 3.7 (which comes QGIS 3.4) - in normal command prompt its showing Python 3.7.0 and path from qgis 3.4. I confirmed version and path running ...
1
vote
1answer
57 views

How to close a composer using PyQt5

migrating from 2.8 to 3.4 i stumble on what seems a simple task: closing programmaticaly an opened composer. To open it is no trouble with the layout manager but to close it is another story. the ...
1
vote
1answer
45 views

QGIS 3 : Qt Signal emmitted when selecting a layer?

I am currently writing a QGIS 3 plugin. I would like to catch the signal emmited each time the user selects a new layer in the layer panel. I have already searched in the QGIS API (QgsProject, ...
2
votes
0answers
50 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 ...
0
votes
0answers
34 views

Couldn't load plugin 'openlayers_plugin' due to missing 'QtWebKitWidgets'

I am using Qgis 3.8 and I am trying to use the plugin OpenLayers. However, when I try to install the plugin I receive the following error: Couldn't load plugin 'openlayers_plugin' due to an error ...
3
votes
1answer
99 views

ERROR IN processing.run('qgis:countpointsinpolygon',XXX)

When I tried to write a python script to run Count points in polygon (https://docs.qgis.org/2.8/en/docs/user_manual/processing_algs/qgis/vector_analysis_tools/countpointsinpolygon.html) in QGIS, I ...
2
votes
1answer
80 views

Interface of QGIS plugin created by QtCreator

The image below is the interface of the plugin which I created using Qt Creator. However, when I loaded this plugin in QGIS3 (version: 3.6.1). The interface of the plugin does not appear completely. (...
1
vote
1answer
17 views

Pulling images into QTWidget (plugin dialog box) from web server? [closed]

I'm trying to show images in a dialogue box (built using QT Creator and interacted with through my plugin). I have the images as a list of URLs, but can't figure out how to get them to display in the ...
1
vote
1answer
48 views

Value of a ComboBox within a QGroupBox (in a form) by using pyQT5

In QGIS3 I would like to get the current form-value of a ComboBox, that is within a QGroupBox (in the form). I would like to get that value by using PyQT5. Has anybody an idea?
2
votes
0answers
23 views

QGIS configuration: Import Style Libary

I would like to script QGIS to import a style library as part as a configuration for a new user. By Python commands, how do I instruct QGIS to do what a QGIS user can do with the "Import Items" ...
1
vote
1answer
103 views

QgsApplication.processingRegistry() loads providers however is empty when called in within class function

I am in the process of building a standalone interface to QGIS to use the processing functions. In essence I am creating a mainWindow GUI with a Qgsmapcanvas. The GUI also includes some user inputs ...
2
votes
1answer
66 views

How to duplicate Layout PyQt5 QGIS 3?

I want script in python3 with QGIS 3? For example: This code create a layout 2019_A4 and add Layout Manager. I need a code make same in QGIS3 using QgsLayoutManager with Methods duplicateLayout ...
2
votes
1answer
98 views

Error after loading new plugin Qgis 3.4

In Qgis 3.4, after creating a plugin with plugin builder, compiling it with pb_tools, I still can't load it to Qgis. I keep getting the following error message: "Couldn't load plugin 'test_api' due ...
0
votes
0answers
29 views

Getting active PostgreSQL connection username when stored through authentication configuration in QGIS 3

I've been trying to get the username of a PostgreSQL connection in QGIS 3.6, using this Python code layer = iface.activeLayer() provider = layer.dataProvider() username = QgsDataSourceUri(provider....
1
vote
0answers
155 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 ...
1
vote
1answer
52 views

Referencing a table using PyQt5 on a custom form in QGIS 3

I am currently trying to add logic to a custom form to key out a habitat code. This is for work using UK Habitat Classification. It is based on a 5 level hierarchical code to produce a Primary Code. ...
3
votes
2answers
296 views

Check if button is pressed in QGIS 3 module

There is a plugin I wrote for QGIS and I added some buttons there. From main launch Python script I need to check is specific button is clicked and according to that do some stuff. I saw a default ...
1
vote
2answers
78 views

QGIS2 to QGIS3 plugin migration issue AttributeError: type object 'QObject' has no attribute 'connect' [duplicate]

I am trying to migrate a plugin. I have these two lines: QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Configuration.accept) QtCore.QObject.connect(self.buttonBox, ...
1
vote
1answer
35 views

Trying to find the Qt5 version of QVBoxLayout

Migrating a plugin and started getting the error AttributeError: module 'qgis.PyQt.QtGui' has no attribute 'QVBoxLayout' I cannot find this one in the API changes I tied using qgis.PyQt5.QtGui but ...
1
vote
1answer
136 views

TypeError: qRegisterResourceData(int, bytes, bytes, bytes): argument 2 has unexpected type 'str'

Similar question here, I tried the suggested answer but it didn't work for my situation. updating plugin from qgis 2 to 3. qRegisterResourceData . argument 2 has unexpected type 'str' I am ...
1
vote
0answers
18 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
1answer
56 views

QgsLayerTree alternative in QGIS 2.x

I developed a plugin for QGIS 3.x but I need to adjust it to work with QGIS 2.x too. Here is code which is working nice with QGIS 3.x: root = QgsProject.instance().layerTreeRoot() #QgsLayerTree ...
1
vote
1answer
303 views

QGIS Compiling 3.6.0 Troubleshooting about PyQt5, SIP, Qscintilla on Ubuntu 18.04 LTS

I work on UBUNTU 18.04 LTS/bionic, I am trying to compile QGIS 3.6.0, for an upgrade from QGIS 3.2. 0. I am facing the same trouble as several people the release compatibility between SIP and PyQT5 ...
1
vote
0answers
43 views

How to run PyQT code inside python console(editor) in QGIS? [closed]

I have built a simple PyQt application(inserting list item in QListWidget) which runs outside the QGIS environment.I want to integrate that inside the QGIS so that all the map layers will be inside ...
1
vote
0answers
41 views

Open Identify Results Window from QGIS Plugin [duplicate]

I am trying to open Identify Results docked window using qgis plugin. How can i open the identify results window using feature id? I am iterating through active layer, get a specific feature and then ...
1
vote
0answers
39 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. ...
0
votes
0answers
71 views

pyinstaller3.4 package of pyqgis 3.7 standalone program failed import qgis.core due to missing PyQt5.QtPrintSupport

I have a qgis standalone program that is develop with python3.7/pyqt5.11 that come with the OSGEO4W's QGIS 3.4.4 (the latest LTR), it has the following imports: import os, sys import sip from PyQt5 ...
1
vote
1answer
121 views

Filter layerlist in snapping dock of QGIS3 to show only layers selected in the layer-dock (TOC)

I would like to filter the layerlist in the "Snapping and Digitizing Options"-Dock so that only layers are shown which are selected in the TOC of the QGIS-Layer-Dock. At the moment I use a workaround ...
2
votes
1answer
535 views

Stuck on how to list loaded layers in QGIS 3 via Python

I've stuck on a issue about getting a list of loaded layers. I've two layers loaded, one spatial (point, line or area) and another one non spatial (postgresql table). I've tried this code but it lists ...
1
vote
1answer
72 views

Access the Vertex Tool (Current Layer)

Since QGIS 3, there are two vertex tools: current layer and new: all layers. Normally I was able to access all actions with the code below. But now I can't find and activate the vertex tool (current ...
1
vote
1answer
176 views

QGIS 3.4.4 - PyQt 5 - Browsing button doesn't react with QFileDialog.getSaveFileName()

I'm trying to work through the tutorial : http://www.qgistutorials.com/en/docs/building_a_python_plugin.html to build a plugin in QGIS 3.4.4. and to implement it with PyQt5 (instead of PyQt4 library ...
3
votes
0answers
148 views

QGisPlugin : Trigger closeEvent by clicking 'X' in QgsAttributeForm

This is the code: def formOpen(dialog, layer, feature): """Function called when a connec is identified in the map""" global feature_dialog # Create class to manage Feature Form interaction ...
2
votes
1answer
388 views

How to open and add SQLite connection to browser with PyQgis

I have a code to open the layers of a SQLite database. When executing this code, the layers are loaded correctly (1 & 2). However i also need to connect to the database and show the connection in ...
0
votes
0answers
40 views

QGIS 3 Python terminate mapTool

Using QGIS 3 I am calling a mapTool to get the coordinates of a user input on the canvas. The function is called by a button in the toolbar. Before the mapTool is loaded a UI is opened to insert ...
6
votes
2answers
883 views

QGIS 3 Get coordinates from mouse click

I am working on a small QGIS Python plugin and want to get the X/Y coordinates from a user click on the canvas. I have a small UI called from button in a toolbar. After filling the UI with information ...
1
vote
0answers
78 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
1answer
86 views

QDockWidget not showing content at first sight

I'm loading the QDockWidget and it does load fine and has the content but it seems that doesn't have a fixed size that avoids it's content to be hidden once loaded. this is how it looks when is ...
0
votes
0answers
22 views

Find diagram for understanding pyqgis

In orther to undestand the api of pyqgis, i'd like to konw where can i find a diagram of pyqgis api ?
0
votes
1answer
270 views

Qgis 3.4 - How could I add a QDockWidget to Qgis interface using Python

I was looking for a way to add a panel and I found QDockWidget but I don't seem to find the way to add a new panel since examples I've seen use a Qgis tool to create these panels or use QDockWidgetto ...
1
vote
0answers
36 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
0answers
282 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 ...
3
votes
1answer
188 views

Get xy coordinates of QgsMapCanvas in PyQGIS 3?

I am trying to get the QgsMapCanvas coordinates when they change using PyQt5 and PyQGIS 3. What I have used for that: self.canvas.scaleChanged.connect(lambda: self.showScale(self.canvas.scale())) ...
1
vote
1answer
147 views

Access icons from within QGIS plugin with relative paths?

I have constructed a QGIS plugin using QGIS Plugin Builder 3.0.3. Within my plugin, I need to load a .png file as a Qicon object. What needs to be done for the plugin script to locate the .png file ...
1
vote
0answers
39 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 = ...