Skip to main content
3 votes
Accepted

Custom panel is created but does not display properly in custom plug-in

This short snippet is working for me (QGIS 3.34): from qgis.utils import iface dock_widget = QDockWidget("DockWidgetTest", iface.mainWindow()) label = QLabel('Test') dock_widget.setWidget(...
juliustoth's user avatar
2 votes

Expression is not working in QgsRasterCalculator with PyQGIS

Following code produces a result by using two arbitrary layers (with random values between 0 and 10) created by me in a Linux system (for this reason the differences in syntax for naming directories). ...
xunilk's user avatar
  • 30k
2 votes
Accepted

Optional argument has wrong value when used with action trigger

It happens because the triggered signal passes the value of the QAction’s checked state to any connected slots. Your slot is receiving that value, which is false by default. Because the signal is ...
couteau's user avatar
  • 36
1 vote
Accepted

QGIS Python Get and layout item's Uuid

Layouts do not have a uuid. The layout manager can return a list of layouts, so you can use the index of that list to target them instead E.g.: manager.printLayouts()[0]. The list should be in the ...
SirLostalot's user avatar
1 vote

Make the legend that auto wrap in QGIS

Expression Builder has a wordwrap function that you can use to wrap text in a legend (including it's elements). Example: wordwrap(@symbol_label, 37, ' ')
Comrade Che's user avatar
  • 7,271
1 vote
Accepted

Layers corrupted after saving, closing and opening of QGIS project with PyQGIS

I had missed adding the layer to the project, so it wasn't truly part of the project, it just appeared to be. The answer was to add the layer to the project without rendering it, and then add the ...
John_nz's user avatar
  • 31
1 vote

QGIS script keeps crashing

As @bugmenot123 commented, this sort of script is intended for use outside of QGIS, but I tested it externally and it still crashed, so: Try changing: qgs.exitQgis() To: qgs.exit() I have seen this ...
SirLostalot's user avatar
1 vote
Accepted

Deactivating the render checkbox of status bar with PyQGIS

This checkbox is a part of the QGIS's Status Bar. It could be accessed via the QgisInterface class and its corresponding statusBarIface()-method: Returns a pointer to the app's status bar interface. ...
Taras's user avatar
  • 33.3k
1 vote

Automatically loading layers on startup (problem) using PyQGIS

After some time away from qgis scripts, this is the solution I found: Apparently, when you try to add a python script file to QGIS "add scripts to toolbox", it gets coppied to qgis scripts ...
Pedro Cury's user avatar

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