9
votes
PyQt signal when layer name is changed in PyQGIS
Use the nameChanged signal of QgsLayerTreeNode class.
from qgis.core import QgsProject
def name_changed(node, name):
print(f"New Name: {name}")
QgsProject.instance().layerTreeRoot()...
7
votes
Accepted
Counting seconds using QTimer in PyQGIS
For what you are trying to do, QTimer.singleShot() is not really what you want. I would suggest setting an interval, then connecting your slot function to the timeout signal of QTimer and calling ...
3
votes
AttributeError when creating list field with QVariant in QgsVectorLayer using PyQGIS
I could get the same error as you:
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS32~1.0\apps\Python39\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "&...
2
votes
Counting seconds using QTimer in PyQGIS
Without classes or global variables:
from itertools import count
timer_printer = lambda t: print(t)
counter = count(1) # start at 1
timer = QTimer()
timer.setInterval(1000) # 1000 milliseconds = 1 ...
2
votes
QGIS3 quits after PyQt Script 2 run
If you want to run your code inside QGIS, you don't need the QApplication() call
import sys
from PyQt5.QtCore import (QSize,
Qt)
from PyQt5.QtWidgets import (QApplication,
...
2
votes
Accepted
Error with PyScripter and QGIS 3.22, can't find DLL
I found another workaround: because setting the DLL search path automatically changed in Python 3.8, you have to do this explicitly in your script. I use a start-script for the Python-Interpreter ...
1
vote
Pyqt5 : dynamically change label value, with no clicking signal
In the end I used the showEvent method : it is called right away, without waiting for a user action.
def showEvent(self,showEvent):
self.fillComboBox()
It is very useful !
1
vote
Accepted
Error when importing another py and ui files in my QGIS plugin
It was in fact a basic error, I forgot the breaks after the 'show' function...
Just in case it would help, when using show() I can still interact with the main window. However, if I use exec_(), the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
pyqt5 × 176pyqgis × 109
qgis-3 × 64
qgis × 49
qgis-plugins × 47
python × 36
pyqgis-3 × 23
pyqt × 11
qt-designer × 11
qt × 8
gui × 6
ubuntu × 5
python-3 × 5
pyqt4 × 5
qgis-processing × 4
qgis-2 × 3
standalone × 3
folium × 3
combo-box × 3
qgis-custom-widgets × 3
layers × 2
fields-attributes × 2
import × 2
snapping × 2
osgeo4w × 2