Questions tagged [pyqt]

PyQt provides bindings for Qt 2 and Qt 3.

Filter by
Sorted by
Tagged with
2 votes
1 answer
41 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 ...
  • 723
2 votes
1 answer
36 views

Access own defined Toolbar with 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) ...
  • 57
0 votes
1 answer
42 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
  • 27
1 vote
1 answer
49 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 (...
  • 27
0 votes
1 answer
55 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 ...
  • 27
1 vote
0 answers
70 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 ...
  • 24.6k
0 votes
1 answer
122 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....
  • 622
6 votes
1 answer
185 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,607
3 votes
1 answer
106 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 ...
1 vote
1 answer
31 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
63 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 ...
  • 336
1 vote
1 answer
45 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....
  • 445
4 votes
1 answer
86 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 ...
  • 336
3 votes
1 answer
513 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 ...
  • 133
0 votes
0 answers
131 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 ...
3 votes
2 answers
754 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 ...
  • 455
6 votes
1 answer
70 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 ...
1 vote
1 answer
85 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....
  • 53
5 votes
1 answer
748 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
331 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 '+' ...
0 votes
1 answer
205 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 ...
2 votes
1 answer
255 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 ...
  • 21
1 vote
1 answer
579 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.
  • 1,169
2 votes
1 answer
319 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
273 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....
  • 6,309
2 votes
2 answers
518 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
156 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 ...
  • 373
1 vote
0 answers
132 views

Taking picture from QGIS Plugin using PyQt [closed]

I have a button in a Plugin to take a photo and relate it with a feature of a layer in QGIS. My aim is to select a feature, open a camera view (viewfinder), take a photo and save it with the feature ...
4 votes
1 answer
2k views

Error "No module named PyQt5.QtCore" in QGIS standalone application

import os, sys sys.path.append(r'C:\Program Files\QGIS 3.6\apps\qgis\python') sys.path.append(r'C:\Program Files\QGIS 3.6\apps\qgis\bin') sys.path.append(r'C:\Program Files\QGIS 3.6\apps\Python37') ...
0 votes
1 answer
109 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. ...
  • 447
0 votes
1 answer
165 views

How to create custom shortcut to set visibility in QGIS with PyQT?

I have been trying to make custom shortcut to set visibility to given layer. For example, I have two layers I work on LAYER_1 however I use LAYER_2 as reference, but sometimes I need to hide LAYER_2 ...
  • 53
2 votes
1 answer
933 views

Using PyQt in PyQGIS inside QGIS 3.16

This code Using PyQt5 extracted from http://www.tutorialspoint.com does not work when I add it in a script in the console of QGIS 3.16. Can you enlighten me on this subject? import sys from PyQt5 ...
6 votes
1 answer
5k views

Making a Feature Form for a standalone PyQGIS application as in QGIS

In QGIS, there is a method named openFeatureForm defined in QgisInterface class. It opens a form that shows value of attributes for a given feature. layer = iface.activeLayer() feature = layer....
3 votes
1 answer
474 views

Image Adding Problem to QGIS Plugin GUI with Qt Designer

I'm using QGIS 3.1 and I created a plugin. Finally, I want to add a image(.png) to my plugin's GUI with Qt Designer. But when I add it, QGIS gives an error when it opens and my plugin does not work. ...
  • 33
1 vote
0 answers
158 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 ...
  • 1,503
3 votes
2 answers
986 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 ...
  • 445
1 vote
0 answers
82 views

Create a plugin to connect PostgreSQL db and run a query using QGIS Plugin

I have prepared a code to connect PostgreSQL database and run a query on the database using PyQGIS and it is running successfully on python console of QGIS. I want the same to happen using QGIS Python ...
1 vote
0 answers
40 views

Is it possible to open below code on PyQt Designer? [closed]

I want to add some design via PyQt Designer to below GUI: class Ui_MainWindow ( object ) : def setupUi (self, MainWindow) : MainWindow.setObjectName ( "MainWindow" ) ...
  • 19
1 vote
1 answer
365 views

Is there a way to refresh the browser on QGIS programatically with PyQGIS?

I have tried the QgsBrowserModel but it doesn't seem to work. I am not even sure if that is the right class to use. The problem is that I add WMS and database connections through a plugin but they won'...
  • 43
0 votes
0 answers
857 views

How to Open QFileDialog In QGIS 3 plugin?

i tried to open file dialog with Qgis Plugin its through argument 1 has unexpected type Error here My code # -*- coding: utf-8 -*- """ /**************************************************...
0 votes
1 answer
108 views

Use plugin code in QGIS python script

I would like to write a Python script in QGIS and would like to use functions from a plugin. For example, QuickOSM plugin has an import function and an "Open" button, that creates a ...
2 votes
0 answers
91 views

What's the role Qwidget and Qlayout in the QGIS interface?

I use miniconda3 to manage my software installations, including QGIS, so I can use packages like geopandas easily in the QGIS python console. Lately however, when I open qgis from the command line ...
2 votes
1 answer
456 views

How can I launch a QWidget after pressing a submenu (QAction) in QGis3.4?

I need your help I am developing a dialog box (which I will call toolraster) in QGis to interact with raster layers. I want it to display when I click on a menu I insert in the QGis interface. I ...
  • 1,374
0 votes
1 answer
146 views

Creating QGIS Shapefile in PyCharm leaving some attributes NULL

I've created the shapefile and can manually enter in all the attributes to come in fine, but when I call it any other way (which I will need to do), the values for the floating types appear as NULL, ...
  • 131
1 vote
0 answers
149 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?
3 votes
1 answer
255 views

Problem: QGIS-Plugin that involves setting a shortcut, does not work when run a 2nd time

I am trying to build a Qgis plugin which involves setting shortcuts to perform some function on the selected layer in the plugin. When I use my plugin for the first time, everything works as expected. ...
4 votes
0 answers
3k views

Problem with font size depending on screen resolution - QT

I developed a QGIS plugin by designing the interface with QT Designer. The inferface appears correctly on my computer (left image). However, on some computers, I encounter size problems, especially ...
1 vote
0 answers
143 views

Problem compiling ui to python for a QGIS 3 plugin

I've created a .ui using QT Designer for a QGIS 3.10 plugin called 'bhlayers' which has a docking widget to the right. When I used the: pb_tool deploy command it didn't seem to translate the .ui to ...
  • 445
0 votes
0 answers
569 views

Update QDialog live without freezing UI

So I am currently working on a QGIS Python plugin and I want to update a QDialog with textoutput while an import of data from one file the another is running. So while it is grabbing data from one ...
  • 21
1 vote
0 answers
146 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 ...

1
2 3 4 5 6