Questions tagged [pyqt4]

python bindings for Qt4

Filter by
Sorted by
Tagged with
0 votes
2 answers
152 views

How to make my plugin dialog window open as QGIS default plugins?

Actually I mean that: As you can see, I make my own plugin and qgis opened my dialog window like second window. I need somthing like this: Here is Validity Check plugin. This is QGIS internal plugin ...
Industry666's user avatar
3 votes
1 answer
1k views

Developing QGIS plugin: AttributeError: object has no attribute

I was tasked with making a small plugin for QGIS or add a small functionality to an existing one. What I am trying to do is take the "geocode with web service" from the plugin MMQGIS and add ...
qgisStruggler's user avatar
2 votes
1 answer
521 views

How to display table content using Qtableview after selecting a vector layer in Pyqt4?

I'm developing a QGIS plugin using QtDesigner and pyqt4. I have a comboBox of my vector layers and I want to show the table of the selected layer. I used this code for my comboBox: def run(self): ...
GIS_lounge's user avatar
3 votes
0 answers
122 views

How to make buttons work from second window in my QGIS plugin?

I'm trying to develop a QGIS plugin. I already created a second window. In that second window, there are several buttons that I need them to work. I can't say I'm a programmer that's why I don't ...
GIS_lounge's user avatar
1 vote
1 answer
4k views

How to change the particular letter color in text box using python

I need to highlight the particular letter in a text box using Python. I am using the below code but it changes the entire text color in text box. Can you suggest any other ideas? I am using both ...
Kurinji Nathan Kumar's user avatar
2 votes
1 answer
454 views

Tableview with 2 columns

I'm using QlistView to show my names of departement in the studied area after using the 'extract by location' processus: # res=QgsVectorLayer() # capture département inside the studied area : ...
zak's user avatar
  • 43
2 votes
0 answers
145 views

How to capture the event whenever the items inside a listview are checked

I'm developing a plugin in QGIS 2.8.2 using Pyqt 4. Well the idea is using the processing 'qgis:extractbylocation' from the QGIS algorithm provider to capture the studied area # Récupérer tous les ...
zak's user avatar
  • 43
2 votes
1 answer
1k views

How do I call the objects created with QtDesigner (or QtCreator) in my code in python? Where is this information in python? PyQt4 please

Where can I find a good documentation on how to refer (to call) to the Dialog created with QtDesigner? For example, a buttomBox (or any other) just created. I’m trying to make a plugin, but the ...
Romário Carvalho Neto's user avatar
1 vote
0 answers
95 views

Blank MapCanvas Window [closed]

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 ...
Sansa Stark's user avatar
4 votes
1 answer
628 views

How to get QGIS canvas in plugin window? [closed]

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 ...
Ivan's user avatar
  • 145
1 vote
0 answers
27 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, ...
Mark Schmucker's user avatar
2 votes
2 answers
1k 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, ...
MrKingsley's user avatar
  • 1,443
1 vote
1 answer
1k 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 ...
MrKingsley's user avatar
  • 1,443
1 vote
0 answers
252 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 ...
Bhuvaneswari's user avatar
4 votes
1 answer
1k 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 ...
MrKingsley's user avatar
  • 1,443
1 vote
0 answers
133 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 ...
yasir's user avatar
  • 123
1 vote
0 answers
40 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 ...
pioupiou's user avatar
1 vote
1 answer
2k 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 ...
raghava's user avatar
  • 11
15 votes
1 answer
1k 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 feature from which I would like to inform ...
Thomas B's user avatar
  • 8,714
6 votes
1 answer
848 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(...
Thomas B's user avatar
  • 8,714
3 votes
0 answers
87 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 ...
KorBuno's user avatar
  • 31
0 votes
1 answer
2k 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 ...
user32882's user avatar
  • 3,494
0 votes
1 answer
220 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....
Snaileater's user avatar
  • 5,703
0 votes
1 answer
3k 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 (...
Jesse Yishai's user avatar
2 votes
1 answer
352 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 ...
Luismi's user avatar
  • 975
3 votes
1 answer
377 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 ...
Wonka's user avatar
  • 115
1 vote
0 answers
746 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 * # @...
Mustafa Uçar's user avatar
0 votes
1 answer
1k 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 ...
Mustafa Uçar's user avatar
1 vote
0 answers
1k 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) ...
user1745564's user avatar
1 vote
0 answers
251 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. ...
Marcelo's user avatar
  • 161
13 votes
3 answers
7k 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'...
sigeal's user avatar
  • 879
6 votes
2 answers
31k 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" ...
ennine's user avatar
  • 863
2 votes
2 answers
613 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 ...
Basile's user avatar
  • 3,533
8 votes
2 answers
3k 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 ...
abd0991's user avatar
  • 432
3 votes
2 answers
981 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 ...
Filip Zorić's user avatar
2 votes
1 answer
174 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 ...
user avatar
2 votes
1 answer
92 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 ...
Redoute's user avatar
  • 2,050
2 votes
1 answer
2k 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 ...
user730119's user avatar
1 vote
1 answer
253 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 ...
Dizee's user avatar
  • 19
2 votes
0 answers
616 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 ...
Ahsan Mukhtar's user avatar
3 votes
1 answer
612 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. ...
geotom's user avatar
  • 61
1 vote
1 answer
77 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 ...
Sunny Naik's user avatar
3 votes
1 answer
1k 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 ...
tinyplanet00's user avatar
2 votes
0 answers
242 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' ...
vaibhav Dhiman's user avatar
2 votes
2 answers
386 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....
vaibhav Dhiman's user avatar
2 votes
1 answer
2k 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 ...
neistuff's user avatar
2 votes
0 answers
264 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,...
Marco Gabrielli's user avatar
3 votes
1 answer
752 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. ...
Ben's user avatar
  • 727
2 votes
1 answer
720 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 ...
jessie jes's user avatar
  • 1,061
3 votes
1 answer
2k 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 ...
Sassá's user avatar
  • 498