Skip to main content

Questions tagged [pyqt]

PyQt provides bindings for Qt 2 and Qt 3.

Filter by
Sorted by
Tagged with
17 votes
11 answers
19k 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, ...
Greg's user avatar
  • 551
13 votes
4 answers
10k views

Developing GUI in Python for ArcGIS geoprocessing using PyQT/Tkinter/wxPython?

I want to develop a GUI in Python for ArcGIS geoprocessing. Can I use PyQT for GUI programming in ArcGIS? I have also considered using Tkinter and wxPython.
BBG_GIS's user avatar
  • 5,825
6 votes
2 answers
3k views

Usage of QgsTask and QgsTaskManager

I'm trying to test the new QgsTask and QgsTaskManager, I found some examples in the PullRequest in github. I modified it slightly and added a print(i) in the code bellow: from qgis.core import ...
axel_ande's user avatar
  • 2,074
2 votes
1 answer
2k views

Capturing mouse movement on QgsMapCanvas?

I have a python app that uses QgsMapCanvas as map display. I put it inside a QWidget, which is then inside another control. The problem is that there seems to be no way of tracking mouse move event on ...
For Comment's user avatar
  • 1,115
8 votes
3 answers
5k views

How to use Threads in PyQgis, mainly to keep UI active?

I'm trying to develop a plugin, which does heavy computations and as a result, user interface becomes inactive. I know that I should use threads to keep the UI alive (specifically, I have a progress ...
Alex's user avatar
  • 937
5 votes
1 answer
3k views

Work around for “Couldn’t load PyQt” error with QGIS 3.0.3 on Ubuntu 18.04?

I am working with a fresh install of Ubuntu 18.04 and installed QGIS using https://qgis.org/debian. I get the following error when I launch QGIS: Couldn't load PyQt. Python support will be disabled. ...
Ned Horning's user avatar
5 votes
2 answers
826 views

Properter to get travel time as cost for network analysis

What I want to do is calculate travel times between points within a road network. I know there are options with GRASS (via v.net) and pgRouting (and possibly many more). I intent to stick to the ...
Fitzroy Hogsflesh's user avatar
4 votes
2 answers
3k 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 ...
Mar Tijn's user avatar
  • 523
4 votes
1 answer
2k views

PyQGIS reload a QGIS plugin

I have a plugin that has a psycopg2 connection to a PostGIS database. When i close GUI with the X-Button and open it again, all the widgets are filled with the data from before. It looks like the X is ...
Martin's user avatar
  • 2,918
3 votes
2 answers
2k 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__(...
Guamokolatokint's user avatar
2 votes
1 answer
3k views

QGIS 2.99 "qgis._core import error: DLL load failed"

I am trying to run a standalone application. However, it does not run the program because of mentioned error in title. Here is my code: from qgis.core import * from qgis.gui import * from qgis.utils ...
Mustafa Uçar's user avatar
1 vote
2 answers
3k views

QGIS 2.4 - Python 2.7 PyQT4.Qtcore.QStringList Import failed

I receive an import error when trying to import QStringList from the QGIS Python console (or when loading a custom plugin). from PyQt4.QtCore import QStringList Traceback (most recent call last): ...
Peter Peterson's user avatar
0 votes
1 answer
130 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 ...
User1974's user avatar
  • 1,222
8 votes
2 answers
1k views

Remove "Save As" from QGIS Context Menu Using PyQGIS [closed]

I want to remove an existing option ("Save As") from context menu of QGIS layer, what I have found so far is, to add new action in the LegendItems, or overwrite completely with new options. But could ...
Ahsan Mukhtar's user avatar
8 votes
2 answers
6k views

QGIS relations widget in custom form

I've just begun exploring QGIS relations option, now in version QGIS 2.2, details here: http://blog.vitu.ch/10112013-1201/qgis-relations This is a great implementation of something I've been ...
user25976's user avatar
  • 2,125
8 votes
1 answer
22k views

How to fix 'Could not find the Qt platform plugin “Windows” in “”' when implementing qgis in custom Python3 application?

I am implementing qgis 3.4.3 in a custom application, but when I instantiate the QgsApplication() class, I receive the error "Could not find the Qt platform plugin "Windows" in "". I've attempted ...
Matt Brauer's user avatar
7 votes
1 answer
542 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())) ...
user9962595's user avatar
7 votes
1 answer
922 views

Moving cursor using PyQGIS?

I would like to move the cursor to a given x,y coordinates of the MapCanvas. Is there an easy way to do this using PyQGIS?
Snaileater's user avatar
  • 5,743
6 votes
1 answer
682 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 ...
wanderzen's user avatar
  • 2,130
6 votes
2 answers
258 views

What is QDomNode and QDomDocument in terms of PyQGIS?

On a low level what is QDomNode and QDomDocument in the PyQGIS context? I comprehend that both QDomNode and QDomDocument are derived from PyQt. Hence, with my limited knowledge of PyQt, I simply do ...
Taras's user avatar
  • 33.7k
6 votes
1 answer
2k views

how to open second window in my plugin for QGIS?

I create a Mainwindow for my plugin, but if I want to open a second window from this Mainwindow, with click on push button. How can I do? I tried the following function in my Main Class: dialog = ...
Davide G.'s user avatar
6 votes
1 answer
3k views

Adding a Tiles/wms? (openStreetMap) layer with python in QGIS

In my QGIS python plugin I want to add a background map (if the user haven't added one), hence I think I missing something in the url for the Tiles/wms service.. (the function returns invalid layer) ...
axel_ande's user avatar
  • 2,074
5 votes
3 answers
4k views

Should you switch from ArcMap to QGIS? [closed]

Background: Our group has full ESRI licenses and applications built with ArcGIS Desktop. We are invested in the arc geodatabase itself and will not change that tier. There is a proposal to switch ...
Omnia9's user avatar
  • 463
5 votes
4 answers
1k views

QGIS Plugin with save settings dialog

I am writing on an update of the qgis2leaf plugin. It would be great to store the settings of the plugin UI (like which checkboxes are checked, which strings are used) in a separate file (like xml or ...
Riccardo's user avatar
  • 2,678
5 votes
1 answer
1k views

How to create sub-menus in QGIS 3 plugin

I'm trying to create a sub-menu in a QGIS plugin like in the image. I found this Add extra item to drop down menu plugin. "Layers menu from project" plugin but I'm using QGIS 3 and PyQT5 and ...
Lorenzo's user avatar
  • 1,085
5 votes
1 answer
1k views

Add extra item to drop down menu plugin. "Layers menu from project" plugin

I have created a drop down menu in QGIS. The code is mainly from the "Layers menu from project" plugin. I have cleaned it so it only have the drop down. My problem is that I will like to add an ...
LAC's user avatar
  • 611
5 votes
1 answer
2k views

Download file from network using PyQGIS 2.x

I have a python plugin targeting QGIS 1.8 that uses QgsNetworkAccessManager and QNetworkRequest to issue a GetCapabilities request to WMS servers. With 1.8 everything was working fine. Now we are ...
Kelly Thomas's user avatar
  • 1,494
5 votes
1 answer
3k views

Using PyQGIS in standalone scripts without crashing

I am new to the PyQGIS API. For developing I use my Spyder IDE with QGIS and GRASS modules. In order to make my script executable I just run my code with the QGIS python.exe in my bat file. This all ...
GeoEki's user avatar
  • 437
5 votes
1 answer
347 views

Referencing Qt UIs external to plugin with python

I'm developing a plugin that sets up a working environment for a user: loading layers (from db), applying styles and several custom designed (Qt) UI files etc. Primary user interaction is in the ...
user30543's user avatar
5 votes
1 answer
379 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....
vealen's user avatar
  • 133
4 votes
1 answer
1k views

How to add loading bar in QGIS Plugin development?

Every time i use tool or plugin in QGIS, i saw a kind of bar like this for indicating loading progress : The different between that bar and Progress Bar is that progress bar will increase until our ...
Faizalprabowo's user avatar
4 votes
1 answer
882 views

How to connect QgsMapLayerComboBox to QgsDataDefinedButton

in Qt Designer there is the possibility to use directly QGIS custom widgets. In the UI I added a QgsMapLayerComboBox (to get the layers added in the legend) and a QgsDataDefinedButton. What I would ...
matteo's user avatar
  • 3,304
3 votes
1 answer
707 views

Using QGIS modules in standalone application with PySide?

I want to make small standalone application using PySide and QGIS Python modules to display satellite images and do standard GIS operations, like creating new a shapefile and placing polygons or ...
user32162's user avatar
3 votes
1 answer
13k views

How to position the Qwidget form/QDialogBox in the left corner using python programming

1) I am creating a Qwidget Form or QDialogBox using QT Designer. I am using the following code to move the form: sDialog.move(50,450) But i want to fit the dialogBox to fit in the left corner.How ...
user99's user avatar
  • 989
3 votes
0 answers
603 views

QGIS QgsAttributeTableModel only loads when called without a function in Python

I tried to load QgsAttributeTableModel into QgsAttributeTableView or a plain Qt QTableView but it could run from inside a class method or function but it runs without any function or method. Below is ...
wondim's user avatar
  • 1,383
3 votes
1 answer
2k views

PyQGIS - QgsMapToolEmitPoint

I would like to make use of Signal and Slot while using PyQgis along with PyQt4. Despite spending some time trying out tutorials and some somewhat related post on gis.stackexchange I can't figure out ...
Peter Peterson's user avatar
3 votes
0 answers
2k views

Canceling task currently running in background using PyQGis?

I am trying to close QgsProject on loading layer (if password and username from QgSProject - datasource are incorrect) before QgsCredentialDialog is shown. on signal : QgsProject.instance()....
ncica's user avatar
  • 942
2 votes
2 answers
699 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 ...
Christian's user avatar
  • 131
2 votes
2 answers
3k views

PyQT: QFileDialog keeps on opening window after clicking on cancel or ok

I use to write QGis plugins, which is based on PyQT. I use to create QButtons and connect their click to a function that itself calls a QFileDialog. For example: def doOpenFile(self): fname =...
Bruno von Paris's user avatar
2 votes
0 answers
278 views

QPyNullVariant not recognized outside of QGIS [duplicate]

I'm getting an error about an operation involving a QPyNullVariant: TypeError: unsupported operand type(s) for *: 'QPyNullVariant' and 'float' I wanted to put a check into my code to skip these ...
Kris's user avatar
  • 313
2 votes
2 answers
5k views

How to draw a Circle of fixed radius in QGIS using QgsMapCanvasItem?

I have derived a class from QgsMapCanvasItem for drawing circle of some radius at a given latitude and longitude. In my paint function I am using QPainter to draw the circle as void paint (QPainter* ...
Saurabh Bhola's user avatar
2 votes
1 answer
687 views

How to get a group layer delete signal in QGIS

I'm developing a plugin into QGIS 2.18. I need to catch if the user deletes a group layer. I tried the signal layerWillBeRemoved from QgsMapLayerRegistry class but it sends only layers not group layer....
SYG's user avatar
  • 180
1 vote
1 answer
2k views

Layer properties dialog in my QGIS plugin [closed]

I am developing a plugin which should display some information like geometry of the layer, feature count etc. Now those are currently displayed in QMessageBox.information. I want it to be displayed ...
User123's user avatar
  • 2,986
1 vote
0 answers
1k views

Overlaying Google Map in standalone PyQgis application? [closed]

I have created a standalone PyQGIS app (within Python itself, not a plugin) with PyQt and PyQGIS API. It generates my map really well. I would like to overlay a Google Map layer as base map just like ...
Victor Zhiyu Lee's user avatar
1 vote
1 answer
490 views

Why does QGIS 2.4 prematurely terminates on startup at "Starting Python"?

After reinstalling Python (3.4) as well as OSGeo4W and the QGIS Standalone, my QGIS always crashed when "Starting Python" on my Windows 7 64 Bit environment. It simply did not proceed to the QGIS-GUI ...
Florian R. Klein's user avatar
1 vote
1 answer
289 views

GIS Action that loads a raster, creates pyramids and sets color

Using the code in "Developing QGIS Action which loads a raster". from PyQt4.QtCore import QFileInfo,QSettings from qgis.core import QgsRasterLayer, QgsCoordinateReferenceSystem s = QSettings() ...
Daniele Piccolo's user avatar
0 votes
1 answer
192 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, ...
Barnard87's user avatar
  • 151