16
votes
How can I add a second Toolbar Button and Dialog to a QGIS plugin built with Plugin Builder?
1. Use Plugin builder to create a new plugin
The files created are shown in the following picture
2. Convert the resources file (resources.qrc) to Python file (resources.py) using the OSGeo4W Shell
...
12
votes
Accepted
How to compile QtDesigner user interface (.ui) and resource (.qrc) files with QGIS 3 on Windows?
You need set PyQT5 environments.
This is my scripts for compile QGIS 3 Plugins and have 3 complementary bats.
compile_ui.bat
@ECHO OFF
set OSGEO4W_ROOT=D:\OSGeo4W64
set PATH=%OSGEO4W_ROOT%\bin;%...
8
votes
Accepted
How to populate QTableWidget via plugin?
Let me share how it works for me:
self.setWindowTitle(title)
#data = 'Recordset back from postgis'
nb_row = len(data)
nb_col = 2
qTable.setRowCount(nb_row)
qTable.setColumnCount(nb_col)
for row in ...
8
votes
Accepted
Do I have to publish own QGIS plugins?
Do you have to publish it?
Legally, The GPL License of PyQGIS forces you to share the code only with your "client", therefore your company.
So No, you don't have to publish it. You can keep them ...
8
votes
Target a specific attribute table
Below a code with a simple QDialog with 2 comboBoxes (specialized for QGIS to display layers and fields) :
class MyDialog(QDialog):
def __init__(self, parent=None):
super(MyDialog, self)....
7
votes
Accepted
How can I add a second Toolbar Button and Dialog to a QGIS plugin built with Plugin Builder?
Here's what I did to implement a second Toolbar button and its corresponding dialog:
Edit the plugin.py file to add a run2() method, a self.dlg2 variable, a new action in initGui(), and this import:
...
7
votes
Accepted
Getting directory path from QgsFileWidget using PyQGIS
Plugin Builder adds a method named run to the plugin.py. You can implement the script below with a little editing. I assume you have set storageMode to QgsFileWidget.StorageMode.GetDirectory for ...
6
votes
Accepted
How to add loading bar in QGIS Plugin development?
A good and user friendly way to do it is using the QgsMessageBar class.
A first look here by the author of this class:
http://nathanw.net/2013/08/02/death-to-the-message-box-use-the-qgis-messagebar/
...
6
votes
Accepted
Connecting Qt GUI to python code in QGIS Plugin
Your "check boxes" don't work because you're putting your lines in the wrong place (run method). However, you need first to declare objects in __init__ method for connecting them to a 'change_status' ...
6
votes
Accepted
Embbeding QgsLayoutDesignerInterface in plugin widget using QtDesigner and PyQGIS
Based on this quote from your question:
My goal is to simply display (no edit settings needed) a map layout in
a plugin widget as soon as the related map is chosen from a combobox
.
My guess is that ...
6
votes
Accepted
Connecting signals to different functions based on combobox selection
Instead of making individual connections for each combobox options, it is more reasonable to connect the button click event to one function which checks the combobox value and calls the related ...
5
votes
QtDesigner add map canvas widget
Just choose a QWidget and promote it.
From PYQGIS official guide:
It can be also embedded into an existing widget or window. When using
.ui files and Qt Designer, place a QWidget on the form and ...
5
votes
Python GUI for QGIS plugin ; 'ModuleNotFoundError: No module named...'
Is there a file called resources.py? This is probably generated from a resources.qrc file by a rule in your Makefile, if that tries to use pyrcc4 it will fail on QGIS 3 because it uses Qt 5.
https://...
5
votes
No custom widgets in Qt Designer for QGIS 3
In QGIS 3.2.0, custom widgets seem to be available:
Tested on Windows 7 64-bit.
Edit:
I used the QGIS Standalone Installer Version 3.2 (64 bit) and following the simple on-screen instructions. Once ...
5
votes
Accepted
No custom widgets in Qt Designer for QGIS 3
The environment and path needs to be set for Qt Designer to access the QGIS Custom widgets. These can be set by running the "qgis-designer.bat" file that comes with a QGIS installation. For a ...
5
votes
Accepted
Making Upload button for shapefile in QGIS plugin?
If you look at step 23 in the tutorial you'll see
some lines in the run method:
if self.first_start == True:
self.first_start = False
self.dlg = SaveAttributeDialog()
You need to find those ...
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 ...
5
votes
Qt Designer forms and QGIS
You can link a ui file directly to a table under Properties > Attribute Form, and select Provide ui-file from the top combobox.
You can dynamically load a ui to a Python class inheriting from ...
5
votes
Qt Designer forms and QGIS
I designed a sample form in QtDesigner. Here is the form which contains one button:
In QGIS Python Console or Editor,
Load this form using uic.loadUi.
Define a method.
Connect this method to the ...
5
votes
Accepted
PyQT plugin window is always smaller than when run in QGIS
Simply dragging and dropping widgets onto a dialog in Qt Designer is a quick way to get a working ui, but it does not in any way guarantee consistent appearance.
To demonstrate this, I created a dummy ...
4
votes
Accepted
How to connect QgsMapLayerComboBox to QgsDataDefinedButton
Thanks to the qgis-dev mailing list and to Denis Rouzaud, this is the answer..
class MyDialogClass(UiClass):
def __init__(self):
self.setupUi()
self.myLayerComboBox.layerChanged.connect(...
4
votes
How to display a picture in QGIS custom form?
The solution which does not require python is
In QtDesigner
Add a new QWidget (or any other widget which serves as a container) and in the properties set the objectName to match the field's name. (I....
4
votes
Accepted
How to use Qt3 Support widgets in QGIS plugin?
The widgets which you are referring to are leftovers from Qt3.
QGIS at the moment is based on Qt4 (which exists since 2005 and has seen end of life in December 2015) and is soon to be updated to Qt5 (...
4
votes
Accepted
How to filter out layers with QgsMapLayerComboBox?
Guess it was easier than I thought, I just had to create a list of QgsMapLayers from a group I want excluded in the QgsMapLayerComboBox:
root = QgsProject.instance().layerTreeRoot()
other_group = ...
4
votes
Accepted
QGIS 2.18 : Choosing path of file for Python init function
I found a solution - don't know if it's the best one, but it's fine by me.
I added a startup.py file in the .qgis2/python folder. This file must contain the following lines:
import sys
sys.path....
4
votes
Accepted
Python GUI for QGIS plugin ; 'ModuleNotFoundError: No module named...'
In your case you need to use relative path instead of absolute path. Assuming that ais is present in same directory as main.py you need to change
from ais import AISForm
to
from .ais import ...
4
votes
Accepted
How to get QGIS canvas in plugin window?
In QT designer you need make right click on the widget and select "promote to", and write the class and header as seen in the image.
after you need compile the .ui.
In the class that loads this ui, ...
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 ...
4
votes
Accepted
Image Adding Problem to QGIS Plugin GUI with Qt Designer
I found a solution with the help of this post.
It worked for me. I'm on QGis 3.16, I hope it's the same for the 3.10 version.
Once you've added the resource image. You need to open the file ...
4
votes
QgsFileWidget mandatory field in QWizard issue
Try to pass the third parameter as string which refers property name, filePath here.
self.wizardPage.registerField('projPath*', self.projPath, 'filePath', self.projPath.fileChanged)
Here is a working ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
qt-designer × 129qgis × 75
pyqgis × 52
qgis-plugins × 38
python × 20
qgis-3 × 17
qt × 17
pyqt × 16
pyqt5 × 11
qgis-2 × 8
gui × 7
combo-box × 6
pyqgis-3 × 5
pyqt4 × 4
qfield × 3
plugins × 3
widget × 3
qgis-custom-widgets × 3
layers × 2
attribute-table × 2
csv × 2
qt4 × 2
postgresql × 1
openlayers-2 × 1
field-calculator × 1