Questions tagged [pyqt]

PyQt provides bindings for Qt 2 and Qt 3.

Filter by
Sorted by
Tagged with
0 votes
1 answer
43 views

Bringing to front QGIS plugin dialog with toolbar icon click

Is there a way to bring the already opened QGIS plugin dialog that I wrote to the front with a click on the icon in the QGIS toolbar? By default, it only opens on click, and to bring it to the front I ...
5 votes
1 answer
510 views

QGIS Python Plugin - Prevent Dialog From Closing Immediately after OK Clicked

I've generated a QGIS plugin using the QGIS Plugin Builder v3.0.3. One issue I am encountering with it is - as soon as I click the "OK" button (that invokes the run method) - the dialog closes. Is ...
2 votes
2 answers
115 views

Create always open dialog after layer configurations are set in a PyQGIS plugin

I'm creating a small plugin, where you can copy-paste values from one layer to the other by selecting relevant features in both layer (see here : QGIS: PlugIn for semiautomating copying attribute ...
1 vote
0 answers
23 views

Navigate to next group of features in QGIS form view of attribute table [closed]

I'm using QGIS to visually interpret land dynamics over sample locations. Samples are spatially clustered and in many cases all samples of a cluster share the same dynamic and can be edited all at ...
4 votes
1 answer
109 views

PyQGIS Contour Labelling

I have generated contours using gdal:contour in a pyqgis plugin but am unable to add labels to them. This is the code that I have been trying to get working, but obviously doing something wrong. ...
4 votes
1 answer
201 views

QgsVectorLayer creation in Qthread (PyQt)

Our QGIS project is dynamically generated on startup based on user roles. There are nearly 120 QgsVectorLayers that need to be generated. If created sequentially, the login process takes up to 2 ...
3 votes
1 answer
99 views

Setting the output type using QFileDialog.getSaveFileName

I am trying to set my output parameters in a script for Qgis using QFileDialog This is the code that I am using parent=iface.mainWindow() outputFn, outfnOK = QFileDialog.getSaveFileName(parent, ...
4 votes
1 answer
51 views

Connecting signals to different functions based on combobox selection

I'm working on a Qgis plugin (using QT Designer). The goal of the plugin is, depending on the combobox, clicking on a button will launch different functions. For example, choosing "Images - WMS&...
2 votes
2 answers
414 views

QGIS' pyrcc5 gives error on macos Catalina

When trying to build a QGIS plugin with Plugin Builder 3, I get the message that pyrcc5 was not found in my path. I installed PyQt using brew install pyqt, but still nothing. Instead, I tried to run ...
0 votes
1 answer
46 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 ...
0 votes
1 answer
240 views

PyQGIS Problems Update to 3.24.3 with Qt Library 5.15.3

I update QGis to 3.24.3, with this new version, QGIS update Qt library to 5.15.3. Now when I run my PyQgis App, I have this error: Cannot mix incompatible Qt library (5.15.3) with this library (5.15....
7 votes
3 answers
17k 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
1 answer
73 views

Install and run GDBee file geodatabase SQL tool

GDBee is a Python tool for querying file geodatabases using SQL (outside of ArcGIS): https://github.com/AlexArcPy/GDBee I want to install and run GDBee in Windows 10 (64-bit). As a novice, here's what ...
3 votes
1 answer
111 views

Accessing custom Toolbar using PyQGIS

I created a toolbar in a plugin with: toolbar = iface.addToolBar("new Toolbar") I know I can toggle visibility of this toolbar with: toolbar.setVisible(False) and toolbar.setVisible(True) ...
0 votes
1 answer
187 views

QThread crashes QGIS

I'm trying to use a QThread for CSV export that can freeze my UI. Therefore I have a polyvalent Thread class below : class Thread(QThread): finished = pyqtSignal() def __init__(self, fn, *...
2 votes
3 answers
2k views

Can't render my own map canvas inside QGIS plugin window [closed]

My goal is to make a standalone application using the QGIS library, but for now I'm trying to make everything work in a QGIS plugin. I need to create a map canvas inside my plugin window. There is ...
16 votes
10 answers
18k views

QGIS plugin: Problems importing resources (resources_rc) file - plugin doesn't load - PATH problems?

I'm building qgis plugin and I can't find solution for this error. File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 478, in _import mod = _builtin_import(name, globals, locals, ...
2 votes
1 answer
93 views

How to display the attribute value in an information window?

The following code is used to test if a selected object from layer A is inside an object from another layer B. Depending on the result, a window is displayed and indicates the answer. The object ...
0 votes
1 answer
62 views

How to retrive field name from selected field in QgsFieldComboBox

I want to read the field name as string format from a QgsFieldComboBox. How to read? I tried like following but not working for some comparison. selectedField = self.dlg.QgsFieldcomboBox.currentField
2 votes
1 answer
124 views

Shapefile (vector layer) for particular selected features in PyQGIS

I want to create a new shapefile (vector layer) from selected features. I select one feature then save that feature to a new shapefile. When I use following code, I got a new shapefile but it's blank (...
0 votes
1 answer
234 views

How to use QgsFieldComboBox in building QGIS plugin

I am developing a plugin in QGIS which involves the use of QgsFieldComboBox, what I want to do is that the combo box only shows fields(column names from attribute table), and from this ...
3 votes
0 answers
176 views

Bringing PyQGIS and PyQt into already settled Anaconda Python environment in PyCharm

I have Anaconda Python environment with different packages required for developing a QGIS plugin (including the Plugin Builder Tool etc.). (qgsdata) C:\TempDaten\_dev\QgsData>conda info ...
1 vote
0 answers
204 views

Reloading aprx that has been modified using ArcPy with ArcGIS Pro

I'm writing a python script tool for ArcGIS Pro that uses a custom GUI created with pyqt. I would like the tool to be able to add and remove layers from the main map in the ArcGIS Pro project it is ...
2 votes
2 answers
2k views

Looking for manual on how to properly setup standalone PyQGIS without GUI

My goal is to create a standalone PyQGIS script that is able to run QgsProcessingAlgorithm scripts without GUI. My setup runs on Windows and my IDE of choice is VS Code. I've followed the Windows ...
3 votes
1 answer
170 views

Get M-value from shapefile by mouse click on canvas

I am new to QGIS plugin scripting (3.16 Hannover) (in Python 3.7). I have lots of different layers in my layers panel and I want to be able to click on a button on my GUI, which then activates a ...
6 votes
1 answer
443 views

Running function from double click with PyQGIS

How can a double-click in the QGIS canvas be used to run a function in PyQGIS? For example, I want to access the name of each feature I'm selecting with a double-click. Code sample to access the ...
1 vote
1 answer
53 views

QgsAttributeTableView shows nothing in my QGIS plugin

I have created a plugin using the Plugin Builder plugin, and I tried to adapt it to show a QgsAttributeTable (by following this example). I get absolutely no errors or warnings, but it simply shows an ...
0 votes
0 answers
97 views

PyQGIS plugin, disable Qt dial at start, from outside __init__ function?

I know I can disable the dial widget from the main function that loads the Qt dialog form with self.dial_name.setEnabled(False) but don't want to modify the function, to keep all modifications ...
4 votes
1 answer
130 views

Change Qt dial size in .ui file, PyQGIS plugin

The main dialog in the plugin is entirely defined by an .ui file. No css stylesheet yet, nor processing (except for some values, not to define the controls). I need a 2nd dial but its function is ...
1 vote
1 answer
83 views

Placing plugin or action in submenu using PyQGIS or PyQT

I am trying to place a plugin into a submenu of "Vector". In this case "Geoprocessing Tools". When I use: iface.addPluginToVectorMenu('Geoprocessing Tools',action) or: iface....
3 votes
1 answer
958 views

Display a progressBar and use the execution time of several functions in QGIS plugin

I developed a plugin under QGIS and I added a progressBar using QT Designer. Using a pushButton, I execute several functions directly in the __init__(self, iface) function. What I want to do is to ...
0 votes
0 answers
323 views

PyQt SpinBox value is always returning value of 0 / SpinBox not recognized

I'm creating a plugin in which I use spinboxes. The value set by the user on the spinboxes is meant to define precision in which the result will be printed. Even though my spinbox has different values ...
8 votes
1 answer
3k views

Programmatically change layer position in the table of contents (QGIS)

I am trying move/position a layer to the bottom of the TOC by using addTopLevelItem on all other layers. I unsure how to reference the layers as QTreeWidgetItem's. def bg_bottom_level_item(self): ...
6 votes
1 answer
2k views

Disabling automatic selection in QgsMapLayerComboBox

I build a plugin. It has a lot of comboboxes (QgsMapLayerComboBox). They are all empty when no project is loaded. When I open a project in QGIS, a layer is automatically shown in all comboboxes. All ...
2 votes
1 answer
183 views

Collapsing legend in ToC via PyQGIS

I am creating QGIS simple plugin which adds and set styles. It works like a charm, however i want to collapse all legends(categories) from styles in given layer i tried layer....
2 votes
2 answers
676 views

Opening Plugin with another Plugin

I would like to open a Plugin with the help of another Plugin. Is it possible, if I want to switch the workflow of different plugins one after the other, that when I click the submit button of one ...
3 votes
1 answer
544 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 '+' ...
3 votes
2 answers
1k views

Segmentation fault (core dumped) QgsApplication

import os, os.path,sys from qgis.core import * from qgis.gui import * from PyQt4.QtGui import * from PyQt4.QtCore import * class MapExplorer(QMainWindow): def __init__(...
5 votes
1 answer
2k views

Capturing CTRL+Key In KeyPressEvent in PyQGIS QgsMaptool

I created a Line with help of QgsMapTool and I'm able to capture the single key in keyPressEvent like this: class buildingEditTool(QgsMapToolEdit): def keyPressEvent(self, event): ...
2 votes
1 answer
375 views

Store QGIS map themes (to XML)

I would like to store QGIS Map themes to be used later. In my workflow, I use a plugin which imports many (grouped) layers. Each layer contains several styles that I can switch between. I want to ...
1 vote
1 answer
1k views

Custom forms and Python logic: attribute error [closed]

As a beginner to Python, PyQt4, AND QGIS, I am attempting to work with the custom forms feature in QGIS. At this point I'm not sure if my error comes from the code or the .ui. This blog gave me a ...
2 votes
0 answers
403 views

QGIS Python plugin crashes when using processing algorithms and QThread

I'm developing a QGIS plugin which calls several processing algorithms. I call them in a pipeline where the input layer of each algo is the output of the previous one. The pipeline is called on each ...
2 votes
1 answer
371 views

PyQGIS zoom using PyQt list widget

I have created a layer filter Expression to get specific results query from my layer and I add these results in a list widget using PyQt. My Expression and my add to list widget work fine (I print ...
4 votes
1 answer
999 views

Loading Shapefile in a standalone PyQGis App

I'd like to open a shapefile in a standalone PyQGis App. The App starts and runs without a problem but a get an false-Return in the isValid()-Function on the Layer and the Layer doesn't show up. I ...
0 votes
1 answer
180 views

QgsNetworkReplyContent.content() empty after HTTP error

I have a custom Flask backend and a QGIS plugin as client. I make a request with the QgsNetworkAccessmanager with blockingPost() to an endpoint which returns a JSON response on either HTTP status. ...
2 votes
1 answer
1k views

PyQT plugin window is always smaller than when run in QGIS

I'm making this plugin and it's big as seen in the screenshot below However, when I open it in QGIS, it's small and it's troublesome to keep adjusting the size.
2 votes
1 answer
589 views

Enabling/Disabling layer feature selection in QGIS

I have been looking for a QGIS toggle to disable layers' feature selection like in ArcMap/MapInfo. Found Setting layer as unselectable to avoid identifying features in multiple layers using QGIS but ...
1 vote
0 answers
367 views

PyQt Push Button randomly stops working in PyQGIS plugin

I keep running into a very weird issue with clicked.connect not working in various plugins I am working on. The error happens randomly in QGIS 3.x versions and it seems to happen on some machines only....
3 votes
2 answers
2k views

Converting PyQt5.QtCore.QVariant to string

I am using QGIS with the in-built Python console. I want to replace some values in a shapefile with some other values. But when I try to change the attribute values, I get an error about the data ...
1 vote
1 answer
3k views

Popup menu on Mapcanvas right-click

I would like to have a pop-up menu when right-clicking the MapCanvas (the identifyFeatures tool does it...) Could anybody give me a starting point on how to achieve this?

1
2 3 4 5 6