Questions tagged [pyqt]

PyQt provides bindings for Qt 2 and Qt 3.

Filter by
Sorted by
Tagged with
15
votes
9answers
16k 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, ...
13
votes
4answers
9k 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.
8
votes
2answers
5k 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 ...
8
votes
1answer
18k 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 ...
8
votes
1answer
548 views

Do I have to publish own QGIS plugins?

If I develop QGIS plugins for my company do I have to make them available to others? I use QT-Designer and think that it also depends on the question how you develop your plugins, right? For example: ...
8
votes
3answers
3k 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 ...
8
votes
2answers
1k views

Custom forms feature in QGIS: QMessageBox.warning closes QDialog as well

I am attempting to work with custom forms in QGIS. I have included a validate function in my code that will pop a QMessageBox() if the validation fails. My problem is that when I close the QMessageBox ...
8
votes
2answers
695 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 ...
7
votes
1answer
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
1answer
650 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?
6
votes
1answer
323 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())) ...
5
votes
3answers
3k 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 ...
5
votes
4answers
920 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 ...
5
votes
1answer
2k 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. ...
5
votes
2answers
630 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 ...
5
votes
1answer
604 views

Keep UI Settings for a QGIS plugin

I'm writing a plugin that interacts with external software (hydrological models). One of the dialogs has a lot of entries (parameters to pass to the hydrological software). Once the user has set up ...
5
votes
1answer
1k 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 ...
5
votes
1answer
2k 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 ...
5
votes
1answer
310 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 ...
5
votes
2answers
841 views

Drop down list QGIS Plugin based on keyword search

I am developing a QGIS plugin, using python and Plugin Builder plugin of QGIS. I have created a textEdit text box on the plugin. I want to show a list of matching words from the database as user will ...
5
votes
1answer
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 = ...
5
votes
1answer
680 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 ...
5
votes
0answers
2k views

Connect to QGIS 2.6 Python Plugin function via button on custom feature form

I am trying to connect to a QGIS 2.6 Python plugin function via a custom feature form button. On my feature form, I'm attempting to do a few things : enable the updateButton only if the ...
4
votes
1answer
2k 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) ...
4
votes
1answer
8k views

how do I create simple yes/no dialog in qgis python plugin?

I'm making a QGIS plugin that processes a dataset. I started with pluginbuilder and have a GUI that allows me to set what to do. As my plugin is making changes, when it detects a certain threshold of ...
4
votes
2answers
7k 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 ...
4
votes
2answers
426 views

How to show only postgres vector layers in a QgsMapLayerComboBox?

I started to develop a plugin for QGIS in python and I need to list postgres layers in a QgsMapLayerComboBox. I used a QgsMapLayerProxyModel to show only vector layers from canvas: self.dlg.comboBox....
4
votes
1answer
1k views

How to sort layers within groups with Python?

After running a longer script (Qgis Console), all I want to do is sort the layers within my groups; since some of them are buffers and the 'biggest' buffer is now on top. I've tried stuff based on: ...
4
votes
1answer
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 ...
4
votes
1answer
144 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') ...
4
votes
2answers
1k 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 ...
4
votes
1answer
654 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 ...
4
votes
1answer
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....
4
votes
1answer
341 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 ...
4
votes
1answer
232 views

Python QGIS plugin could not load on linux build in window

I have created a plugin in QGIS windows version using "Plugin Builder". which on a button click opens another window, that is calling another class in the dialgoue python file, with another .ui file. ...
4
votes
1answer
835 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 ...
4
votes
2answers
515 views

Is it possible to customize openFeatureForm of PyQGIS?

I am a beginner at PyQGIS. I am trying to create a plugin, which will be used to Add, Delete, and Edit the Feature. It is more customized than which is provided by QGIS (2.2). I am capturing the ...
4
votes
1answer
71 views

Using QgsNewVectorLayerDialog

I am using QgsNewVectorLayerDialog for taking user input for creating a new shapefile. When the user clicks OK I am reading the inputs selected by the user using the following code. dlg = ...
4
votes
1answer
308 views

Showing only selected features from a a layer in the QgsComposerLegend?

I have developed a custom qgis plugin. I have a button to export the map canvas in the form of image along with the legend. I came up with the following code for the legend: legend = ...
4
votes
0answers
483 views

Why PyQt http request works in QGIS console, but not in a plugin?

I want to send http request in a QGIS plugin using PyQt. I found in this post working syntaxes to do so, but something odd occurs. The script given in the question works both in the console and in my ...
4
votes
0answers
82 views

QGIS plugin window qt creator formatting is ineffective

I am developing a QGIS plugin. I have assigned the QGIS main window as the parent window of custom plugin using: QtGui.QDialog.__init__(self, iface.mainWindow()) But after doing so the problem is ...
3
votes
2answers
199 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 ...
3
votes
2answers
223 views

Creating a plugin that presents a list of projects as buttons, and opens one when pressed?

I'm pretty new to creating plugins, and python. I've created a plugin called open_projects that has 10 buttons, and I'd like each button to open up a project when its pressed. The plugin works when ...
3
votes
1answer
10k 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 ...
3
votes
1answer
196 views

Purpose of “myPlugin_dialog.py” file created by QGIS Plugin Builder

I usually use QGIS Plugin Builder to create working templates for QGIS plugins. While a generic Python plugin needs the files below; __init__.py metadata.txt resources.py (translated from resources....
3
votes
2answers
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__(...
3
votes
3answers
2k views

Can not Run function when item selected in comboBox. Pyqgis. QGIS

I'm writing a plugin, I want to change the content of a comboBox (fields) depending of the content of another comboBox (layers). My plugin is a dockwidget. I can populate the fields comboBox just ...
3
votes
2answers
1k views

How to switch to edit mode vector layers, in pyqt application based on qgis?

I do QGIS based application, I need to implement the ability to modify the geometry of vector layers in manual mode (editing nodes), how to do it?
3
votes
1answer
235 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 ...
3
votes
1answer
101 views

Checking if attribute table is showed on the screen with PyQGIS

I'm using the code in this question (Checking the opening of an attribute table with pyqgis) to check if there are attribute table open in QGIS. More precisely, I need to check if some attribute ...

1
2 3 4 5