GIS Plugins

Home › Adopt a plugin › QGIS 4 port guides › NumericalDigitize

NumericalDigitize QGIS 4 port guide

NumericalDigitize in the directory · 271,314 downloads · Latest release 0.4.8 (2024-08-08)

Not QGIS 4 ready · Automatic port estimate for 0.4.8: Medium

These notes come from reading the linked source. Runtime behavior still needs testing.

Source notes for version 0.4.8

Test in QGIS 4

Create a line from pasted vertex coordinates on a scratch layer, select it with the feature picker and edit a vertex. Check the resulting coordinates and the dialog icons.

Qt 6 and QGIS 4 checklist

  1. Scope enum values. An unscoped name can raise AttributeError when the widget opens. Use Qt.AlignmentFlag.AlignLeft for Qt.AlignLeft and QMessageBox.StandardButton.Yes for QMessageBox.Yes. Check both the arguments and comparisons with the return value. QGIS enum migration examples
  2. Check imports at startup. Replace direct PyQt5 imports with qgis.PyQt where available. In PyQt6, QAction and QShortcut moved from QtWidgets to QtGui. For a QGIS 4 port, import them from qgis.PyQt.QtGui. Dual-version plugins can keep qgis.PyQt.QtWidgets for these two classes because QGIS 4 re-exports them there. QGIS 4 compatibility imports
  3. Update renamed and removed calls. Use dialog.exec() for dialog.exec_(). Replace QRegExp with QRegularExpression and update matching code, for example rx.match(text).hasMatch() for a substring search. Review QGIS API calls separately. QGIS migration script · QGIS API break notes
  4. Test the package. Enable the plugin in a clean QGIS 4 profile, open its tools, then unload and enable it again. Repeat on the oldest supported QGIS 3 release if keeping dual support. The QGIS migration checker can flag other source changes before testing.
  5. Declare the tested range. In the [general] section of metadata.txt, a plugin supporting QGIS 3 and 4 needs an explicit upper bound such as qgisMaximumVersion=4.99 to include the 4.x series. For a 4-only release, set qgisMinimumVersion=4.0 or the first supported version. The maximum is optional. QGIS 4 ignores supportsQt6. Remove the old flag. QGIS repository migration guide · PyQGIS cookbook metadata reference