Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pyqt4]

python bindings for Qt4

1
vote
0answers
22 views

Blank MapCanvas Window [on hold]

I am constructing a GUI using PyQT4 and QGis. Rigth now I can open the MapCanvas whith same buttons of Zoom In/Out using this code: from qgis.gui import * from qgis.core import * from qgis.PyQt.QtGui ...
-1
votes
0answers
18 views

Adding canvas in python plugin [closed]

How can I insert QGIS map canvas into python plugin designed by QT designer. UI file is compiled and all the logic is done. Now I only need to add canvas in widget when user click on button. Is it ...
2
votes
1answer
43 views

How to get QGIS canvas in plugin window?

I'm working on project where I need insert QGIS canvas as a widget in QGIS plugin. When user click on button it should be loaded into widget. Something like this, this is example where satellite map ...
1
vote
0answers
15 views

Replicating the Layers Panel in my app, with sub-layers [closed]

I've followed this post, using the QGIS Desktop Python Console, to create color ranges for my vector layer. QGIS displays a nice selectable tree in the Layers Panel. Now I want to develop my own app, ...
1
vote
2answers
45 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
22 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 ...
1
vote
0answers
28 views

How to find which direction to flow between two points in QGIS Python? [closed]

I want to find which way direction to go based on two points and line segment. I have two layer line layer and point layer.user selects the two points in lines layer. I have to find which direction to ...
1
vote
1answer
34 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
27 views

QGIS 2.18 - Can't get click coordinates from mapCanvas

Trying to get click coordinates from map canvas but code is not working. Newbie for Python, pyqgis, pyqt I already check these topics but still code is NOT working 1 - QGIS 3 Get coordinates from ...
1
vote
0answers
27 views

Resizing QGIS custom form

I have followed this tutorial to create custom forms in QGIS (I work with version 2.18). However, I seem to be unable to control the shape and size of the form window. Thus, widgets are frequently out ...
1
vote
1answer
140 views

Adding x,y labels in QGraphicsview using pyqt4? [closed]

Here is my sample program. When I need to draw a line for x axis and y label for y axis .so can any one help me how to add a line and labels to scene.i tried different ways but i didn't get the proper ...
13
votes
0answers
354 views

Showing startup-messages on QGIS splashscreen

During the startup of QGIS there are status messages shown in the lower part of the splashscreen like "restoring loaded plugins". I am using a startup.py from which I would like to inform the user ...
6
votes
1answer
247 views

Change background color of Layer in the TOC / QgsLayerTreeLayer with pyqgis

I would like to change the background-color (or font color) of some items in the TOC of QGIS: Example-Mockup: I tried several ways but nothing did the trick so far: layer_list = QgsProject.instance(...
3
votes
0answers
56 views

How can I get real time log in .bat file at QGIS & PlugIn with Python PyQT4

I try to get real time log in batch file with python, then show it to QGIS Plugin real time. ( .bat file have run -jar file ) I success logging but not real time log in QGIS because QGIS is stopped ...
0
votes
1answer
335 views

QgsMapCanvas has no attribute 'setLayers'?

I would like to construct a GUI using PyQt4 and qgis outside of the main QGIS application. I found this tutorial which provides some indications on how to do this. I am looking to build something ...
0
votes
1answer
92 views

Using Stealth QDockWidget?

I'm playing with QDockWidgets. Here is the piece of code i'm trying : def dock(self): widget = uic.loadUi("C:\dock.ui") self.iface.addDockWidget(Qt.RightDockWidgetArea, widget) widget....
0
votes
1answer
2k views

Running Python produces 'No module named 'PyQt4' in Qgis on Mac High Sierra

I was following the instructions in this guide: Create a Polygon Shapefile from Point data and fairly sure I substituted field variables to match my data. However, when I run the script on my Mac (...
1
vote
1answer
109 views

Error Accessing Dockwidget ComboBox. QGIS Plugin. (pyqgis)

I'm writing a QGIS plugin but I'm facing some basic problems. The plugin is a dockwidget. I've built it with plugin Builder and then compiled the resources file. When I try to access the comboBox to ...
3
votes
1answer
146 views

How to monitor changes in layers panel for QGIS?

I'm writing Python script in QGIS 2.18 to alert the user when multiple layers with different projections are added to the canvas. My codes are shown below. from qgis.gui import QgsMessageBar ...
1
vote
0answers
523 views

ValueError: Attempted relative import in non-package

I run myscript and get this error: from qgis.core import * # @UnusedWildImport from qgis.gui import * # @UnusedWildImport from PyQt4.QtCore import * # @UnusedWildImport from PyQt4.QtGui import * # @...
0
votes
1answer
789 views

QGIS 2.18 ImportError: DLL load failed: The specified module could not be found

I try to run the QSwat script and it begins with that: from PyQt4.QtCore import * # @UnusedWildImport from PyQt4.QtGui import * # @UnusedWildImport from qgis.core import * # @UnusedWildImport from ...
1
vote
0answers
257 views

Import Error: PyQt4 disabled by IPython, incompatible QT binding

I'm running QGIS 2.14 and trying to learn how to develop python standalone scripts. Currently I am using Canopy's (v 2.1.3.3542) distribution of Python 2.7. My development is on a Mac (OS 10.13.1) ...
1
vote
0answers
116 views

Implementing signals on add feature with PyQGIS?

I'm trying to implement the code below to run when adding a feature in the layer, but nothing happens even an error message. However when I call the method directly, the routing is executed normally. ...
12
votes
3answers
3k 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
2answers
6k views

How to add a filter to “QFileDialog.getOpenFileName” [closed]

I would like to add a filter to the following code in order to select only the “CSV files”, but I did not succeed: def filePath(title): qfd = QFileDialog() path = "D:\ennine\SIG HTB\BGN" ...
2
votes
2answers
369 views

Keep track of current layers in PyQt plugin for QGIS

I have a QGIS plugin which has a combobox (QComboBox) element with a list of layers currently opened in QGIS. The problem is that the layer list is only updated on initialization of the plugin (I do ...
7
votes
2answers
988 views

Get the identified feature

I use QgsMapToolIdentifyFeature to trap the featureIdentified signal, so i can get some information from the identified feature and show it in a panel within my plugin. here is the code, my problem ...
3
votes
2answers
579 views

Plugin crashes QGIS 2.18 if running simuntaneously with python console

I'm currently developing plugin for QGIS 2.18. From the begining I'm having the same issue. QGIS 2.18 crashes if I run python console while plugin is working something. I saw that print statements ...
1
vote
1answer
65 views

How to display messages in the QGIS log from within a QTimer callback?

So I'm new to QGIS and Qt, and trying to write a simple toy python plugin. I'm trying to get the plugin to do "stuff" at regularly timed intervals, and to test, I'm just trying to get the script to ...
2
votes
1answer
51 views

Follow current line in attribute table?

I would like to teach the QGIS map canvas to follow the current row of an attribute table. I found the method QgsAttributeTableView.currentChanged() as possible starting point, but unfortunately it's ...
3
votes
1answer
772 views

Create a upload button in PyQt QGIS plugin

I want to create 2 upload file button in PyQt. One for image and one for .csv file. If the uploaded file is not in image or .csv file it should thrown an message. I have search a lot on internet and ...
1
vote
1answer
122 views

QTest interactions with the QGIS Map canvas

Is it possible to simulate right or left mouse button clicks on a QGIS map canvas. Currently writing tests for a plugin and need to be able to create a line geometry thorough the use of theses ...
2
votes
0answers
251 views

QTableWidget Resize with Dialogue Python QGIS

I am developing python qgis plugin with QTableWidget inside a tabWidget. How can i set my QTableWidget size and QTabwidget with the Dialogue box. So that when someone expand the dialogue box of the ...
3
votes
1answer
327 views

How to use processing in a PyQT plugin in QGis

I am writing a QGis plugin with UI that should utilize certain QGIS processing tools when the user runs the plugin. Now I tried a lot, searched a lot and came along quite many different approaches. ...
1
vote
1answer
56 views

Modifying the copy coords plugin

I want to modify the copy_coords plugin such that when I click on it, It should open a dialog box and ask for a file name and address. After this it should store all the points I click on into that ...
3
votes
1answer
323 views

QGIS plugin fields will not reset

I am new to PyQGIS and PyQT programming. I have built a small QGIS plugin, which uses the NetworkX library to do some processing of shapefiles. The form executes it's business logic correctly, but ...
2
votes
0answers
105 views

Error While Fetching Data From Postgres In Qgis Plugin

i am trying to fetch data from postgres in qgis and the connection code is working fine in python console but it gives error when i apply that code to my plugin like.. AttributeError: 'NoneType' ...
2
votes
2answers
127 views

Getting Error While Parsing Feature To The lineEdit In Python

am getting error while parsing a selected feature to the lineEdit like, QLineEdit.setText(QString): argument 1 has unexpected type 'long' layer = self.iface.activeLayer() h = layer....
1
vote
1answer
803 views

Converting GeoTIFF file to numpy array to QPixmap with PyQt4?

I'm a student in CS doing an internship and I'm not familiar at all with GIS yet. I have to display a GeoTIFF image (with a single band) into a QPixmap with PyQt4. So, I found some code that could ...
2
votes
0answers
210 views

QGIS Profile Tool dependencies

I'm trying to install the Profile Tool on QGIS 2.14 (newest version present in ubuntugis ppa) and i get this error:'No module named PyQt.QtCore' I have installed the following packages:python3-pyqt4,...
3
votes
1answer
398 views

Error inside pyinstaller app with pyqgis & pyqt4 on Windows

I am trying to generate a standalone exe using the pyqgis and related libraries. I have borrowed from the app in the book 'Building Map Applications with QGIS', by Erik Westra and published by PACKT. ...
2
votes
1answer
509 views

error sip.setapi(api, 1) in pyQGIS

I have installed QGIS via osgeo4w 32 bit yesterday, to take pyqgis api in standalone script, but I have some problems. I have python 2.7.13 32bit and pyqt4 installed from Gohlke. After, I created a ...
3
votes
1answer
945 views

Check if QLineEdit is NULL on a custom form?

I have a custom form with some validation. One these validation is if the value of attribute is NULL. The value of NULL representation on the QGIS is float according of the Configure->Options. How ...
3
votes
1answer
407 views

Rendering a custom bounding box to an image file using python and QGIS?

Edit: the problem was merely a typo in the coordinates (see comment on definition of p). Otherwise the code below should work for other situations, too, if adapted properly. The weird pixelated/grey/...
1
vote
1answer
191 views

Displaying QGIS plugin icons without resources.py file?

I am working on a new QGIS plugin and I am trying to comply with the requirement below. The full requirement is located here. source repository is in good shape: no generated file is ...
1
vote
1answer
429 views

Trigger plugin button using PyQGIS?

I wrote a project macro which, when loaded, hides all toolbars except for one which contains a couple of my plugin buttons. I know it's possible to trigger core buttons like the following example: ...
2
votes
0answers
104 views

Custom QDialog is blank in QGIS 2.8.3

I have a QGIS plugin for displaying feature data and I'm trying to make a custom dialog to prompt the user to change the id of the feature being saved if the id is already in use. For some reason ...
9
votes
2answers
14k views

No module named 'osgeo'

I have installed GDAL and checked on the command line, it is working and when I run the gdal2tiles.py on the command line it works but when I run the same file gdal2tiles.py with python IDLE, I get "...
1
vote
1answer
188 views

Read Sld Style in pyQGIS

I am trying to set a layer's style using pyQGIS. My primary idea was to set the style from a string, but unfortunately I can only do it from a file. This code works as a charm: filename= QDir....
1
vote
0answers
232 views

pyQt error in the PYQGIS API

I install QGIS via OSGeo4W 32 bit on windows 7 32 bit and i want to take PYQGIS API in standalone python script. First I have python 3.5.2 and I have before install sip via pip and pyqt4 via gohlke ...