Questions tagged [pyqt5]

Python bindings for Qt5

Filter by
Sorted by
Tagged with
0
votes
0answers
31 views

Qgis Dialog Not showing any Qwidgets Why?

i tried call another dialog form qgis plugin its show the dialog but not showing any Qwidget in that file how to show them (if i call single ui file its showing fine ) Qgis Plugin Code: from qgis.PyQt....
1
vote
0answers
28 views

Drawing points in real time (or at short intervals) using PyQGIS [closed]

I’m working on a robot that moves in space and transfers its GPS coordinates to the server. I need to create a script in QGIS that will receive coordinates and draw points based on these coordinates ...
4
votes
0answers
35 views

How to use all QGIS 3 custom widgets in Qt Designer?

For example, QGIS 3.4 has various custom widgets such as QgsFieldValuesLineEdit and QgsColorWheel (and later versions have even more widgets) but they are not listed in the QGIS custom widgets list of ...
1
vote
0answers
31 views

Display maps from QGIS in my GUI created using PyQt5 [closed]

I wish to create a GUI using PyQt5 for an application that displays a map created using QGIS. How do I integrate QGIS and PyQt so that the map I wish to display can be shown in my app?
0
votes
0answers
30 views

I can't load a CSVv 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 the ...
0
votes
0answers
30 views

Get width of vertical QHeaderView

How can I get the actual width of the vertical header in a QHeaderView. In the docs I can only find the function sectionSize(). But the docs says: 'Returns the width (or height for vertical headers) ...
0
votes
1answer
551 views

QGIS API 3.2 and PyQT5 in Ubuntu Fails: Native Qt signal is not callable

I'm trying to migrate from QGIS API 2.18 to 3.2 in Ubuntu18. Several changes are made, including the update from PyQT4 to PyQT5. This is the very beginning of my code: from qgis.core import ...
1
vote
0answers
35 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? ...
2
votes
1answer
196 views

Error after loading new plugin

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' ...
1
vote
1answer
31 views

pyqgis: Get the Click on canvas standalone app

I added a subwindow in a MDI area containing a QgsMapCanvas. Defined the clic tool QgsMapToolEmitPoint. But when I click on the canvas there's no response, al least it should print 'clicked'. ¿¿May ...
0
votes
1answer
143 views

The plugin 'C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindowsd.dll' uses incompatible Qt library (Cannot mix debug and release libraries)

I am trying to create a standalone script with QGIS functionality however I continuously run into this error regarding QT platform plugin not loading "windows" not loading. Current error code: qt....
1
vote
0answers
29 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 ...
5
votes
1answer
156 views

Using a custom UI for a QGIS processing algorithm script

In QGIS 2.x I have a PyQGIS script that utilises a custom form created in Qt Designer. I could simply call the form and connect a button to a function with the following: class MyWidget(QtGui.QWidget)...
0
votes
1answer
110 views

PyQGIS in standalone scripts on Mac, import error

Following the PyQGIS Developer Cookbook to use PyQGIS in standalone scripts. Fixed the initial errors by setting the PYTHONPATH and DYLD_PYTHON_PATH to the appropriate folders but am now faced with ...
1
vote
1answer
57 views

Disconnect layer.selectionChanged when project is being closed or layer removed

On QgsProject.readProject I add a slot to some layer's selectionChanged. I tried disconnecting these slots in QgsProject.layersWillBeRemoved but here the project seems already closed, so I can't ...
4
votes
0answers
48 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) ...
2
votes
1answer
79 views

QGIS plugin closing all open PyQt dialogs

In my QGIS3 plugin I need to close all open PyQt5 dialogs. The structure of my plugin is like the following code. To be clear, when I call runCloseDialogs() I want to close both dialogs opened by run()...
2
votes
1answer
88 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
2answers
71 views

Hook two horizontal slider each other - PyQt5

In my QGIS Plugin I have this Qt dialog where there are two horizontal sliders. I'm trying to hook one to the other in this way: if the checkBox is checked, I take the difference between them and if ...
2
votes
2answers
2k views

QComboBox multiple selection - PyQT5

I'm making the gui for my QGIS3 plugin using PyQT5 and QT designer. I have a very long list of items in a QComboBox and I need the user to be able to select one or more items. I know that QComboBox ...
0
votes
1answer
118 views

Retrieve data from multiple selected cells in QTableWidget for a QGIS Plugin?

I am creating a plugin which shows the list of location of vector/raster layers. I am using QTableWidget to show the data. When I select one row/cell and click a QPushButton it opens the specific ...
2
votes
1answer
47 views

QGIS Plugins - How to make sure that Vector and Raster layers in a folder are loaded only once?

Plugin Intro: I am creating a plugin for in-house development which lists the location of vector/raster layers of specific projects. Each project has a number of files ranging from 0 to few hundreds. ...
2
votes
1answer
55 views

Using QCompleter with strings composed by different words in QGIS Plugin - PyQT5

I'm using QCompleter in my QGIS plugin. The code below works well, but I'd love to make it more sophisticated. In this example I have some strings that are composed of some words, for example "How to ...
0
votes
1answer
70 views

Closing composer using PyQt5 [closed]

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
152 views

Using PyQt5 Objects inside QTabWidget and QScrollArea - QGIS Plugin [closed]

I'm using PyQt5 and QT Designer to create the user interface for my QGIS plugin. Now I'm learning to use QTabWidget and QScrollArea. What I don't understand is how to use the objects inside tabs or ...
2
votes
1answer
78 views

TypeError: QgsGeometry.fromMultiPolygonXY(): argument 1 has unexpected type 'list'

When I modify the code (which works) from: vertices = fProject.geometry().asMultiPolygon() for v in vertices: points.append(v) fet.setGeometry(QgsGeometry.fromMultiPolygonXY(points)) to: pt = ...
3
votes
1answer
120 views

Remove parts of QGIS 3 toolbars using PyQGIS

How can I remove specific parts of QGIS toolbar? I know I can remove toolbars using this line of code: iface.fileToolBar().setVisible(False) But what I want is to delete every icon in the ...
1
vote
1answer
79 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, ...
4
votes
0answers
152 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 ...
3
votes
1answer
99 views

Check if PYQT5 Widget is Visible in QGIS Plugin

I'm trying to check if my widget is alredy open/visible before showing it (or before run this function). I need to check this because in my QGIS plugin it can happen that I call this function many ...
0
votes
0answers
61 views

QtDesigner is not starting for qgis bat file

The qt-designer.bat file did not launch the QtDesigner. I have tried the file available with OSGeo4W64 installation but the qt-designer did not starts.I also try to start the qtdesigner from the ...
2
votes
2answers
115 views

PyQT5 - How to use QCompleter, QGIS Plugin

I'm trying to use QCompleter to get something like in the image. The code seems pretty simple, but in my dialog nothing happens. Is there some problem in this code? The dialog is created using Qt ...
0
votes
1answer
96 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
59 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 ...
0
votes
1answer
787 views

QPSQL driver on kubuntu 18.04

I am migrating a plugin to (K)Ubuntu 18.04 and QGIS 3.2 but oddly enough I can't seem to connect to a postgres database. As far as I can see the QPSQL driver is not loaded. I ran the following code: ...
2
votes
0answers
344 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
0answers
99 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
1answer
74 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
1answer
31 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
22 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 ...
2
votes
2answers
99 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
146 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
168 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
147 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 ...
2
votes
0answers
62 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 ...
3
votes
1answer
303 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
120 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
23 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 ...
3
votes
0answers
69 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" ...
2
votes
1answer
154 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 ...