Questions tagged [pyqt5]

Python bindings for Qt5

Filter by
Sorted by
Tagged with
0 votes
0 answers
76 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: ...
TrsBar's user avatar
  • 513
7 votes
1 answer
202 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 ...
Марина Лисниченко's user avatar
0 votes
1 answer
140 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 ...
corvus's user avatar
  • 516
1 vote
1 answer
304 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? ...
Alexander Vocaet's user avatar
1 vote
1 answer
352 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 ...
GothamChess's user avatar
2 votes
0 answers
278 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 ...
Fuzl's user avatar
  • 83
1 vote
1 answer
193 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 ...
skew_t_pie's user avatar
0 votes
1 answer
127 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 ...
wanderzen's user avatar
  • 1,917
4 votes
1 answer
308 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: ...
Devenepali's user avatar
3 votes
1 answer
812 views

Create a video from a track (GPX / KML) using Google Street View images

I am trying to create a video from a track in GPX or KML format from Google Street view images. If I enter the data of the coordinates of a location, I can generate a JPG with that image. My problem ...
RBenet's user avatar
  • 710
2 votes
1 answer
124 views

PyQGIS 3: How can pie charts have a fixed size when automating the process?

I'm unsure how to automate the process for PyQGIS to update the pie charts to a fixed size of 12. The approach I used is not working out and no pie charts are being created. lyr = iface.activeLayer() ...
Colette de Villiers's user avatar
1 vote
0 answers
232 views

QTextTable Insert a Line in a Cell [closed]

I'm trying to put a line in the header of a QTextTable. I have tried four ways to do it: Option 1 - I have used the option to modify the background color of the cell. The problem is, I can't narrow ...
RBenet's user avatar
  • 710
2 votes
0 answers
976 views

How to keep PyQt GUI alive while doing heavy calculation and updating Progress bar and logger

I have a GUI designed with PyQt, this GUI has a progress bar and a logger. when the user clicks the Run button the GUI/QGIS will become "No responding" the actions normally take 45minutes to ...
Ehsan Aliverdi's user avatar
4 votes
1 answer
237 views

Emitting signal when project property is changed using PyQGIS

QGIS API provides QgsExpressionContextUtils to set project properties. But in the class, there isn't any signal. I hope to connect to a signal whenever some of the properties were changed. So is there ...
Zac's user avatar
  • 467
4 votes
2 answers
377 views

Showing dialog box even though QGIS is freezing

I have a long script in PyQGIS that contains three processing tasks after another. I want to display a pop up box (like "QProgressDialog"-Box) for each task when it is finished. Example: ...
POGO's user avatar
  • 286
7 votes
2 answers
2k views

NameError: name 'QMessageBox' is not defined

When I'm loading a CSV into QGIS, I get this error code, see below. Does anyone know what this means? This also is an issue when I attempt to run NNJoin Plugin too. An error has occurred while ...
Joan Lee's user avatar
1 vote
0 answers
233 views

Make sure only one PyQt window is shown

I am developing a plugin for QGIS 3.10. In part of my plugin, I have a UI using PyQt. This form needs to be a singleton. But when I have click several times on the plugin it generates several forms ...
Ehsan Aliverdi's user avatar
2 votes
1 answer
380 views

Selecting file in Plugin

I want the toolbox to prompt out a file select window so that user can select the file and get the path to be used in my Plugin. Where do I start to code since I just have: def run(self): "&...
Wilson Chin's user avatar
1 vote
0 answers
54 views

Overlaying points on map in PyQGIS [closed]

I have added google map with PyQt5 and PyQGIS and I want to overlay points and images on map(specifically in python code) but I don't know how to do that. I am using PyQt5 and QGIS3.
Jenny's user avatar
  • 11
5 votes
1 answer
435 views

How to put QgsCheckableComboBox() into standby

I'm trying QgsCheckableComboBox() in my simple python script in QGIS. How to pause code execution while a comboBox-window is open (like a dialog box)? In my example, I want to ensure that the print() ...
user13892757's user avatar
0 votes
0 answers
467 views

Unable to delete .shp and .dbf files from directory when on canvas PyQGIS

I am creating a standalone PyQGIS application and is met with a problem. When a shapefile is shown on my canvas, I am unable to delete the corresponding .shp and .dbf files in my directory. This is ...
Sean Ang's user avatar
  • 133
1 vote
0 answers
51 views

ProgressBar for a function that has to communicate with QObjects

My Plugin uploads Layers to a WebGIS and the QGIS GUI turns inactive during this process. So that the User knows that the Program hasn't crashed I want to implement a ProgressBar. My first try gave me ...
Nunkuat's user avatar
  • 465
2 votes
1 answer
294 views

Which PyQGIS class is the layer properties menu?

I have a plugin which I want to add options to either the context menu when right clicking a layer at the Layers panel or the properties menu for that layer. How can I call them from PyQGIS? Can I add ...
Dror Bogin's user avatar
  • 3,282
0 votes
0 answers
112 views

PyQt5: Wipe XYZ Connections

I am trying to remove all the xyz connections in a QGIS3 project via PyQt5. I am hitting the following error for the code bellow: for group in getGroupXYZ(self): NameError: name 'getGroupXYZ' is not ...
HelpOverFlow's user avatar
6 votes
1 answer
796 views

Opening embedded canvas in new window with all layers

I am creating a standalone custom PyQGIS application and have some questions regarding canvas. I have read the cookbook: https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/canvas.html ...
Sean Ang's user avatar
  • 133
1 vote
0 answers
149 views

Install the 5.11.2 version of PyQt5 using OSGeo4W setup

How can I install the 5.11.2 version of PyQt5 using the OSGeo4W setup in Windows10? The default version of PyQt5 installed from OSGeo4W is 5.11.3 which is different from the QGIS compilation version, ...
Francisco Camello's user avatar
2 votes
1 answer
2k views

Setting Date and Time for QDateEdit and QTimeEdit

Working on a QGIS plugin, I am struggling to save/load date and time values. Users can enter dates via QDateEdit widget and times via QTimeEdit widget. Values are then stored the following: s = ...
MrXsquared's user avatar
  • 31.2k
1 vote
0 answers
57 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 ...
Ирина's user avatar
5 votes
1 answer
1k 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 ...
Orienteerix's user avatar
1 vote
0 answers
206 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?
DEOTALE RIDDHISH ANANTKUMAR's user avatar
1 vote
1 answer
1k views

I can't load a CSV 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 ...
G.V.'s user avatar
  • 11
1 vote
0 answers
169 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? ...
user138961's user avatar
1 vote
1 answer
164 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 ...
Javier G's user avatar
  • 113
2 votes
0 answers
202 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 ...
thesunnyscientist's user avatar
6 votes
1 answer
736 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)...
firefly-orange's user avatar
1 vote
1 answer
323 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 ...
gumo's user avatar
  • 631
0 votes
1 answer
728 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 ...
Rob's user avatar
  • 189
5 votes
0 answers
133 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) ...
Houska's user avatar
  • 7,433
3 votes
1 answer
618 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()...
Lorenzo's user avatar
  • 1,075
0 votes
1 answer
537 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....
Nur-Hassan's user avatar
2 votes
2 answers
415 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 ...
Lorenzo's user avatar
  • 1,075
0 votes
1 answer
4k 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 ...
lawr's user avatar
  • 70
7 votes
3 answers
16k 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 ...
Lorenzo's user avatar
  • 1,075
2 votes
1 answer
72 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. ...
lawr's user avatar
  • 70
3 votes
1 answer
870 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 ...
Lorenzo's user avatar
  • 1,075
1 vote
1 answer
1k 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 ...
Lorenzo's user avatar
  • 1,075
3 votes
1 answer
694 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 = ...
abhijeet pillai's user avatar
3 votes
1 answer
477 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 ...
DrJacoby's user avatar
  • 751
7 votes
0 answers
950 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 ...
Geert's user avatar
  • 143
3 votes
1 answer
780 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 ...
Lorenzo's user avatar
  • 1,075