Questions tagged [pyqt5]

Python bindings for Qt5

Filter by
Sorted by
Tagged with
2
votes
2answers
303 views

QGIS2 to QGIS3 plugin migration issue AttributeError: type object 'QObject' has no attribute 'connect' [duplicate]

I am trying to migrate a plugin. I have these two lines: QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Configuration.accept) QtCore.QObject.connect(self.buttonBox, ...
1
vote
1answer
184 views

Trying to find the Qt5 version of QVBoxLayout

Migrating a plugin and started getting the error AttributeError: module 'qgis.PyQt.QtGui' has no attribute 'QVBoxLayout' I cannot find this one in the API changes I tied using qgis.PyQt5.QtGui but ...
2
votes
1answer
411 views

TypeError: qRegisterResourceData(int, bytes, bytes, bytes): argument 2 has unexpected type 'str'

Similar question here, I tried the suggested answer but it didn't work for my situation. updating plugin from qgis 2 to 3. qRegisterResourceData . argument 2 has unexpected type 'str' I am ...
1
vote
0answers
25 views

How to pull in and push out text browser?

I am using Qt designer to create a plugin in Qgis3. I want to add description of a tool beside the tool. For this I have tried using 'Text Browser' by connecting it with button. I am able to hide and ...
1
vote
1answer
76 views

QgsLayerTree alternative in QGIS 2.x

I developed a plugin for QGIS 3.x but I need to adjust it to work with QGIS 2.x too. Here is code which is working nice with QGIS 3.x: root = QgsProject.instance().layerTreeRoot() #QgsLayerTree ...
1
vote
1answer
813 views

QGIS Compiling 3.6.0 Troubleshooting about PyQt5, SIP, Qscintilla on Ubuntu 18.04 LTS

I work on UBUNTU 18.04 LTS/bionic, I am trying to compile QGIS 3.6.0, for an upgrade from QGIS 3.2. 0. I am facing the same trouble as several people the release compatibility between SIP and PyQT5 ...
1
vote
0answers
96 views

How to run PyQT code inside python console(editor) in QGIS? [closed]

I have built a simple PyQt application(inserting list item in QListWidget) which runs outside the QGIS environment.I want to integrate that inside the QGIS so that all the map layers will be inside ...
1
vote
0answers
81 views

Open Identify Results Window from QGIS Plugin [duplicate]

I am trying to open Identify Results docked window using qgis plugin. How can i open the identify results window using feature id? I am iterating through active layer, get a specific feature and then ...
1
vote
0answers
70 views

Convert QDialog Plugin to QDockWidget

I have a QGIS 3 plugin that is in QDialog. Everything is functional but i want to change it to QDockWidget and dock it within QGIS. How can i convert it to QDockWidget? I am using QGIS 3 with Pyqt5. ...
0
votes
0answers
99 views

pyinstaller3.4 package of pyqgis 3.7 standalone program failed import qgis.core due to missing PyQt5.QtPrintSupport

I have a qgis standalone program that is develop with python3.7/pyqt5.11 that come with the OSGEO4W's QGIS 3.4.4 (the latest LTR), it has the following imports: import os, sys import sip from PyQt5 ...
1
vote
1answer
144 views

Filter layerlist in snapping dock of QGIS3 to show only layers selected in the layer-dock (TOC)

I would like to filter the layerlist in the "Snapping and Digitizing Options"-Dock so that only layers are shown which are selected in the TOC of the QGIS-Layer-Dock. At the moment I use a workaround ...
3
votes
1answer
1k views

Stuck on how to list loaded layers in QGIS 3 via Python

I've stuck on a issue about getting a list of loaded layers. I've two layers loaded, one spatial (point, line or area) and another one non spatial (postgresql table). I've tried this code but it lists ...
1
vote
1answer
124 views

Access the Vertex Tool (Current Layer)

Since QGIS 3, there are two vertex tools: current layer and new: all layers. Normally I was able to access all actions with the code below. But now I can't find and activate the vertex tool (current ...
1
vote
1answer
315 views

QGIS 3.4.4 - PyQt 5 - Browsing button doesn't react with QFileDialog.getSaveFileName()

I'm trying to work through the tutorial : http://www.qgistutorials.com/en/docs/building_a_python_plugin.html to build a plugin in QGIS 3.4.4. and to implement it with PyQt5 (instead of PyQt4 library ...
3
votes
0answers
187 views

QGisPlugin : Trigger closeEvent by clicking 'X' in QgsAttributeForm

This is the code: def formOpen(dialog, layer, feature): """Function called when a connec is identified in the map""" global feature_dialog # Create class to manage Feature Form interaction ...
2
votes
1answer
612 views

How to open and add SQLite connection to browser with PyQgis

I have a code to open the layers of a SQLite database. When executing this code, the layers are loaded correctly (1 & 2). However i also need to connect to the database and show the connection in ...
7
votes
2answers
2k views

QGIS 3 Get coordinates from mouse click

I am working on a small QGIS Python plugin and want to get the X/Y coordinates from a user click on the canvas. I have a small UI called from button in a toolbar. After filling the UI with information ...
1
vote
0answers
106 views

PyQGIS (3.4) and PyQt5 DLL error

I have installed the new version os QGIS(3.4) on my computer. I am working in a standalone application of PyQGIS so I need to load PyQt5 components. As a difference with previous versions when I try ...
1
vote
1answer
246 views

QDockWidget not showing content at first sight

I'm loading the QDockWidget and it does load fine and has the content but it seems that doesn't have a fixed size that avoids it's content to be hidden once loaded. this is how it looks when is ...
0
votes
0answers
24 views

Find diagram for understanding pyqgis

In orther to undestand the api of pyqgis, i'd like to konw where can i find a diagram of pyqgis api ?
0
votes
1answer
538 views

Qgis 3.4 - How could I add a QDockWidget to Qgis interface using Python

I was looking for a way to add a panel and I found QDockWidget but I don't seem to find the way to add a new panel since examples I've seen use a Qgis tool to create these panels or use QDockWidgetto ...
1
vote
0answers
37 views

QGIS (maptool) Plugin Crashes on some computers

I developed a custom Plugin which inherits from QGIS MapTool.The plugin has user interfaces and can add features to the map based on a GUI. The Plugin works Fine on some computer(when they installed ...
1
vote
0answers
479 views

Custom Attributes form in QGIS 3

I'm trying to customize feature form with ui file, I followed https://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/1 but the attributes values still null when I added ...
3
votes
1answer
267 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())) ...
3
votes
1answer
252 views

Access icons from within QGIS plugin with relative paths?

I have constructed a QGIS plugin using QGIS Plugin Builder 3.0.3. Within my plugin, I need to load a .png file as a Qicon object. What needs to be done for the plugin script to locate the .png file ...
1
vote
0answers
42 views

How to merge polygons to get coordinates of final shape?

I have list of plots numbers that should be merged into multipolygon. As a result I have to get coordinates of final shape (as multipolygon). That is may code: # work only on layer "plots" name = ...
0
votes
1answer
4k views

Problem converting qrc file into py one by PyQt5 [duplicate]

I am in my first steps in PyQt5. I intend to create a plugin within QGis 3.0. I would like to convert the file resources.qrc into py file, by running windows shell commands with python. However, when ...
1
vote
1answer
853 views

Compiling QGIS 3.x (master) on Ubuntu 16.04 with Python3.6 and the latest Qt 5 and PyQt5 familiy modules (PyQt5, sip, qscintilla, pyqtchart)

The problem: Now that the compilation issue is over (Unable to compile QGIS 3.x (master) on Ubuntu 16.04: PyQt5.pyqtconfig module does not exist), QGIS 3 (master) refuses to load Python at startup. I ...
1
vote
1answer
390 views

Problem running PyQt code in Qgis3

I am in my first steps in PyQt and I face difficulties in how to run the following code within QGIS console. I want to create a simple window, but nothing happens. I change main by console and then ...
1
vote
1answer
203 views

Do not save .pgw file

When I capture the screen and save the file it also generates a .pwg file, I do not need it, only the .png self.iface.mapCanvas().saveAsImage("doc.png")
0
votes
1answer
545 views

QGIS API 3.2 and PyQT5 in Ubuntu Fails: Native Qt signal is not callable

I'm trying to migrate from QGIS API 2.18 to 3.2 in Ubuntu18. Several changes are made, including the update from PyQT4 to PyQT5. This is the very beginning of my code: from qgis.core import ...
1
vote
1answer
2k views

Fill a comboBox with the result of a query to sqlServer

I need to fill a comboBox with the result of a query to sqlServer, this result is filtered according to the data that was entered in the batch field Try doing it with pyodbc, but when the form is ...
0
votes
1answer
748 views

QPSQL driver on kubuntu 18.04

I am migrating a plugin to (K)Ubuntu 18.04 and QGIS 3.2 but oddly enough I can't seem to connect to a postgres database. As far as I can see the QPSQL driver is not loaded. I ran the following code: ...
3
votes
1answer
1k views

Unable to compile QGIS 3.x (master) on Ubuntu 16.04: PyQt5.pyqtconfig module does not exist

From: http://pyqt.sourceforge.net/Docs/PyQt5/pyqt4_differences.html there seems to be no more pyqtconfig module in PyQt5: pyqtconfig Module PyQt4’s pyqtconfig module is not supported. The ...
2
votes
1answer
272 views

PyQt5: QFileDialog triggered as many times as plugin is opened

I am new to QGIS and I'm building a plugin on it. The problem I'm facing, I believe, concerns mostly PyQt5. So, in my plugin I'm trying to open a file through getOpenFileName() of QFileDialog. I ...
1
vote
1answer
539 views

Can get PyQGIS 3 map to display in PyQt5 standalone app or menus, but not both

I can run a standalone app but no map shows up, but different from a similar question last year. The code posted last year works for me after editing QGISHOME to Win 10 system (r'c:\OSGeo4W64\apps\...
8
votes
2answers
1k views

No custom widgets in Qt Designer for QGIS 3

There are no custom widgets in my "Qt Designer with QGIS 3.0.3 custom widgets". Is it a bug or I should somehow manually enable them?
3
votes
1answer
824 views

How to get the selected value in a value map with Function Editor in QGIS 3.0.2?

I'm trying to automatically ("on-the-fly") add values to a value map widget depending on the value selected from another value map widget by using the Function editor in Expression dialog in the Layer ...
1
vote
0answers
1k views

Use PyQtGraph by using QtDesigner

I want to create and display a graph on Main Window which I designed in QtDesigner. These plot graph values are taken from table widget, it is not problem. Main problem is here, what I use to show the ...
4
votes
2answers
968 views

“Couldn't load PyQt” While starting QGIS 3.0

The following error shows when I am trying to open QGIS 3.0. Although I have installed PyQt5 and the module can be imported from python. I am using Ubuntu 16.04 LTS
6
votes
1answer
844 views

Compatibility PyQt5 and PyQt4

I'm having some compatibility problems with PyQt5, as expected some of the scripts I wrote are not working. My biggest issues are with these two PyQt4 functions: layer.pendingFields() layer = ...
1
vote
0answers
361 views

QGIS3 error Python on launch, Ubuntu 16.4

I installed QGIS3 on ubuntu 16.4. When I launch QGIS I get an error: Impossible de charger PyQt. (Can't load PyQt) Le support Python va être désactivé. (Python support will be deactivate) ...
1
vote
0answers
868 views

How to create a dialog built in Qt Designer from a QGIS dockwidget

I am building my first python QGIS plugin, which all I want to do is to have a dockwidget that can instantiate a dialog box which I built using qt designer. I built a simple dialog box inside qt ...
2
votes
1answer
723 views

How to import PyQt5 in QGIS 2.99?

I installed QGIS by using OsGeo4W64. I can use pyqgis PyQt5 version in PyCharm. However, when I write scripts in python console in QGIS, it does not accept. I looked the version of QGIS. It says ...
2
votes
1answer
6k views

ModuleNotFoundError: No module named 'PyQt5.Qsci'

When I run my script I get this error: from qgis.core import * from qgis.gui import * from qgis.utils import * from PyQt5.QtCore import * from PyQt5.QtGui import * app = QgsApplication([], True) ...
1
vote
1answer
195 views

Cannot mix incompatible Qt library

I run my exe on cmd by passing argument and get this error: Cannot mix incompatible Qt library (version 0x50902) with this library (version 0x50901) How can I fix the problem? It is an standalone ...
0
votes
1answer
132 views

How to add path parameter to exe file?

I made an exe file from standalone application. However I want to enter the path variable on cmd when running the exe. My standalone application running *.shp files. But I want to enter path of the *....
12
votes
3answers
5k views

Make QGIS python plugin for both versions 2.x and 3.x?

I am in the process of migrating a QGIS python plugin from QGIS 2 to QGIS 3, and browsing various resources. It's not clear if it's possible to have the plugin compatible with both versions or if it'...
3
votes
1answer
4k views

QGIS ImportError: No module named 'PyQt5.QtSvg'

Recently, I've installed QGIS 2.99 on my new Ubuntu 16.04 LTS desktop: sudo gedit /etc/apt/sources.list deb http://qgis.org/debian-nightly xenial main deb-src http://qgis.org/debian-nightly xenial ...
2
votes
1answer
358 views

Is it possible to write a pyQt5 plugin for QGIS 2.8?

I have just installed QGIS 2.8 and the changelog says Qt5 is now supported in QGIS 2.8. Can anyone tell me if is it possible to write a pyQt5 plugin for QGIS 2.8? Has anyone tried to do this?

1
2