Hot answers tagged

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,399
7 votes

Showing only some layers in QGIS legend?

In the meanwhile I found a solution, maybe a workaround for my app to show a legend with only parts of the layers drawn on the map canvas. For the interested audience I want to give a summary. Adding ...
Detlev's user avatar
  • 4,538
7 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

Insert image in QGIS Plugin using qt creator

It's a while ago I did this this the last time but as far as I remember you can use a resource-file http://doc.qt.io/qt-4.8/resources.html#resource-collection-files-op-op-qrc , add your image there, ...
Thomas B's user avatar
  • 8,654
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

Can I use QGIS with Qt5?

QGIS 2.10 and later can be compiled against Qt 5. Current QGIS master branch (which will become QGIS 3.0) requires Qt 5. That means: if you download QGIS from a known place and it is labeled with a ...
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
  • 75k
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.6k
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,266
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.6k
4 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,703
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
  • 1,907
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
4 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,016
4 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,016
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
  • 2,865
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
  • 40.3k
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
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

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.6k
3 votes

Check if button is pressed in QGIS 3 module

You could connect the pushButton to a function so that when it is clicked, it will do something: result_btn = self.dlg.pushButton.clicked.connect(self.someFunction)
Joseph's user avatar
  • 75k
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
  • 7,678
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
  • 64k
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

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
  • 886
2 votes

Looking for a QGIS tutorial

Have a look at the QGIS User Guide . At the pages 129-130 (in the section 12.5.8 Working with the Attribute Table), you'll find all the user interface buttons you need to update the attribute table. ...
Nahas's user avatar
  • 983
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,622

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