Skip to main content
11 votes

QGIS 3.0 and Qt 5.7 time schedule

According to the official Road Map Qgis 3.0 was released on 2018-02-23. The first Long Term Support 3.x release will be version 3.4 on 2018-10-26.
pLumo's user avatar
  • 6,549
8 votes
Accepted

Get ComboBox selected Layer's path as a string to use in OGR/GDAL method

In this case, layer is an instance of QgsVectorLayer, because currentLayer gives you that. But ogr.Open() needs a path. So you need to get layer source to pass to ogr.Open(). QgsVectorLayer class has ...
Kadir Şahbaz's user avatar
6 votes

How to use Threads in PyQgis, mainly to keep UI active?

Use processing in QGIS 3.x In QGIS 3.x there is an infrastructure in place to have things running in threads. Processing is a good candidate to be what you are looking for when doing "heavy ...
Matthias Kuhn's user avatar
5 votes
Accepted

Installing QGIS 2.14.9-Essen with Qt 5.6.1 on RHEL7 (64-bit)

QGIS 2.xx python plugins depends on PyQT4 - so you need Qt4. Qt5 only let you use QGIS without python and is experimental. The future QGIS 3 will use PyQt5 and python3. See details about QGIS 3 in ...
Dmitry Baryshnikov's user avatar
5 votes
Accepted

How to add DockWidget above the Layer panel using PyQGIS

You can re-add the Layers Panel which would place it below any existing panels: from qgis.PyQt.QtCore import Qt from qgis.PyQt.QtWidgets import QApplication from PyQt4.QtGui import QDockWidget iface....
Joseph's user avatar
  • 76.1k
5 votes
Accepted

Manipulating value with toolbar

I've coded a simple QgsMessageBar which contains a widget with 3 double-spinbox (and their labels), and a QPushButton for load colors. One for each color (Blue, Orange and Red). Each SpinBox have a ...
J. Monticolo's user avatar
  • 15.9k
5 votes
Accepted

Cannot run qgis_process on WSL2, its trying to connect to a display

It is unfortunately not entirely clear from your question how you are calling qgis_process, but I'm attempting to answer anyways because I did run into the exact error before. If you want to call the ...
CodeBard's user avatar
  • 3,651
5 votes

Building QGIS. Is Qt6 supported?

Porting QGIS to Qt 6 is a work in progress as you can see in this QGIS Enhancement Proposal. A lot of developments, tests and workflows are made for building QGIS with Qt6 but at this current time, it'...
J. Monticolo's user avatar
  • 15.9k
5 votes

Display form window as small as possible (QGIS)

That's only half the answer to your question. Using adjustSize(), you can automatically resize the form window. At the moment it's not clear to me how to catch the standard form call. Presumably you ...
Comrade Che's user avatar
  • 7,506
5 votes

Display form window as small as possible (QGIS)

Another approach is to add your own code to the layer settings. The code will be executed only for this layer. This code works after the OK button was pressed (if the Cancel button was pressed - it ...
Comrade Che's user avatar
  • 7,506
4 votes

Manipulating value with toolbar

You want to style your layer based on three values and you want a quick way to change those values. One way to get something close would be to create a layer with no geometry and put the three ...
M Bain's user avatar
  • 2,082
4 votes

Expand QListWidget in QDockWidget in a QGIS plugin

Change verstretch value from 0 to 1 for two QListWidgets. <widget class="QListWidget" name="list_projects"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" ...
Kadir Şahbaz's user avatar
4 votes

QGIS 3.14 vs "no Qt platform plugin could be initialized"

I just installed QGIS 3.10 for the first time on Windows and when I tried to run it with Python I got exactly the same error message. I fixed it by explicitly setting the QT_QPA_PLATFORM_PLUGIN_PATH ...
Heather Norton's user avatar
3 votes
Accepted

QGIS in Qt Widgets (Cross Platform Application)

This question is quite wide, so it's hard to give a very precise answer. So I'll try to anyway. Is this possible? Yes. Really? Actually, most resources you find refer to writing plugins, where ...
Matthias Kuhn's user avatar
3 votes

How can I read in Qt listWidget functionality as Qgis the raster calculator?

QTextEdit is probably not the good Widget for you. Maybe you can try with something like QListWidget. You can use it as in this example:https://wiki.python.org/moin/PyQt/Adding%20items%20to%20a%...
YoLecomte's user avatar
  • 3,340
3 votes
Accepted

QT C++ application using QGIS API

I found the right combination of the above mentioned items to make it possible for Qt to import Qgis libraries and build the app: Qt 4.8.6 for MSVC2010 Qt Creator 4.3.0 (from a Qt 5.9.0 installation)....
Diego Sartori's user avatar
3 votes

Colouring attribute/field on QGIS data form based on value?

If I understand you very well you can do an attribute table formatting using the following steps: Open you attribute table Use Conditional Formatting Rules Select the field the you want to apply the ...
ahmadhanb's user avatar
  • 41.2k
3 votes

Can I use QGIS with Qt5?

I've made Qt5-based QGIS on Windows successfully!! Download: https://github.com/chenguanzhou/QGIS-Windows-Build-Qt5-VS2015-x64/releases
Chen Guanzhou's user avatar
3 votes

Got Pacman instead of circle when buffering point QGIS 2.14 standalone C++ application

I am working on QGIS 3.6, I've translated your code in Python 3 (few changes from PyQgis 2.x, for example fromPoint, QgsPoint and QgsMapLayerRegistry.instance()) and it's working perfectly : ...
J. Monticolo's user avatar
  • 15.9k
3 votes
Accepted

Check if button is pressed in QGIS 3 module

In python you have "events" and "events handler". when an event occurs they usually (not always...) generate a signal that can be caught by the event handler. for example : curLayer.selectionChanged....
Snaileater's user avatar
  • 5,743
3 votes

Manipulating value with toolbar

As a somewhat klugey solution, you can set project- or layer-level variables for the validation criteria. For a project-level variable, go to Project / Properties / Variables and use the + button to ...
Houska's user avatar
  • 8,316
3 votes
Accepted

Create QT variables using for i in range

Use a dict: self.grids = {} # dict for i in range (1,50): self.grids[i] = QGridLayout() # Get the 38th grid grid = self.grids[38]
user2856's user avatar
  • 67.9k
3 votes
Accepted

Using QCompleter with strings composed by different words in QGIS Plugin - PyQT5

You can use Qt.MatchContains flag as filter mode. from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QCompleter completer = QCompleter() completer.setFilterMode(Qt.MatchContains) For further ...
Kadir Şahbaz's user avatar
2 votes
Accepted

When selecting input don't minimize window - pyqgis

Do this in that way: def select_input_file(self): self.d.lineEdit.setText(QFileDialog.getOpenFileName(None, "Choose input file ", os.getcwd(), "*.qml")) Without this iface as a parameter.
dmh126's user avatar
  • 6,772
2 votes

import Map from QGIS into QT Designer

You mean QgsMapCanvas? First place somwhere QWidget. Now right click on this widget and choose "promote" (or replace, I don't remember). Set QgsMapCanvas as class name and set qgis.gui as header file....
dmh126's user avatar
  • 6,772
2 votes

Custom form and field calculation QGIS

I used QtDesigner to generate a QDialog like this: and disabled average and quantity QLineEdits (please note that I did not use any layout - you should use one to make it look nicer!). In QGis the *....
Henhuy's user avatar
  • 906
2 votes
Accepted

GDAL get pixel color

You need to request needed bands and extent into the buffer using GDALRasterIO method (see http://www.gdal.org/classGDALRasterBand.html#a30786c81246455321e96d73047b8edf1). The usage example here: http:...
Dmitry Baryshnikov's user avatar
2 votes
Accepted

How to dynamically change text of checkable icon?

To sum up the results from the comments: Create a callback function which catches the icon.State() and check its value: The function could look like this: myFunc(self): if icon.State() == 1: # ...
LaughU's user avatar
  • 4,204
2 votes
Accepted

Finding QSettings keys from source code?

You can use the QSettings::allKeys() method by first importing it: from PyQt4.QtCore import QSettings Then To get a list of current keys: QSettings().allKeys() To print all keys individually (for ...
Joseph's user avatar
  • 76.1k
2 votes
Accepted

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

Sorry to say this is almost impossible. The way Qt supports conditional styling with stylesheets is by using QObject::setObjectName (see doc) which you cannot do on a tree view item. Your code does ...
Denis Rouzaud's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible