AUDIT REPORT Qt5 → Qt6 / QGIS3 → QGIS4
====================================================================================================

1. GLOBAL SUMMARY
----------------------------------------------------------------------------------------------------
Scanned folder              : C:\Users\franc\AppData\Roaming\QGIS\QGIS4\profiles\default\python\plugins\MAJ_version_Qgis
Python files found          : 5
Modified files              : 5
Files with fixes            : 6
Files with findings         : 0
Automatic replacements      : 11
Critical findings (ERROR)   : 0
Warnings (WARNING)          : 0

qt_compat source            : C:\Users\franc\AppData\Roaming\QGIS\QGIS4\profiles\default\python\plugins\scan_qt6_compat\qt_compat.py
qt_compat destination       : C:\Users\franc\AppData\Roaming\QGIS\QGIS4\profiles\default\python\plugins\MAJ_version_Qgis\qt_compat.py
qt_compat status            : copied

2. QT5 → QT6 STATISTICS
----------------------------------------------------------------------------------------------------
2.1 Automatic replacements by category

  - Centralize lupdate helper: 5
  - QMessageBox.Cancel: 2
  - Rewrite QDialogButtonBox standard buttons to qt_compat aliases: 2
  - DialogCode.Accepted: 1
  - Replace exec_() with exec(): 1

2.2 Detailed fixes by applied rule

  - Add Qt5/Qt6-safe TS generation helper: 5
  - Remove local helper _qt_compat_build_ts_generator_command: 5
  - Enum/token replacement: 2
  - Rewrite QDialogButtonBox standard buttons to qt_compat aliases: 2
  - Add metadata key: changelog: 1
  - Add supportsQt6 after qgisMaximumVersion: 1
  - Ajout/fusion import qt_compat pour alias MSGBOX_*: 1
  - Fallback DialogCode: 1
  - Increment metadata version: 1
  - Replace exec_() with exec(): 1
  - Update/reposition qgisMaximumVersion: 1

3. REMAINING FINDINGS SUMMARY
----------------------------------------------------------------------------------------------------
No remaining findings.

4. FILE-BY-FILE AUDIT
----------------------------------------------------------------------------------------------------

FILE: __init__.py
====================================================================================================
Applied fixes       : 2
Findings ERROR      : 0
Findings WARNING    : 0

4.1 Applied fixes

Line: 1
Rule: Add Qt5/Qt6-safe TS generation helper
Before:
    [missing helper]
After:
    def _qt_compat_build_ts_generator_command(...): ...

Line: 2
Rule: Remove local helper _qt_compat_build_ts_generator_command
Before:
    
    
    def _qt_compat_build_ts_generator_command():
        import shutil
        import sys
        from pathlib import Path
        from qgis.PyQt import QtCore
    
        qt_major = int(QtCore.QT_VERSION_STR.split(".")[0])
    
        if qt_major < 6:
            return [sys.executable, "-m", "PyQt5.pylupdate_main"]
    
        for candidate in ("lupdate", "lupdate6"):
            exe = shutil.which(candidate)
            if exe:
                return [exe]
    
        prefixes = [
            Path(sys.prefix),
            Path(sys.executable).resolve().parent,
            Path(sys.executable).resolve().parent.parent,
        ]
    
        possible = []
        for prefix in prefixes:
            possible.extend([
                prefix / "Library" / "bin" / "lupdate.exe",
                prefix / "bin" / "lupdate.exe",
                prefix / "apps" / "Qt6" / "bin" / "lupdate.exe",
                prefix / "apps" / "qt6" / "bin" / "lupdate.exe",
            ])
    
        for p in possible:
            if p.exists():
                return [str(p)]
    
        raise RuntimeError(
            "No Qt6-compatible lupdate tool was found. "
            "Under QGIS 4, PyQt5.pylupdate_main must not be used."
        )
    
    
After:
    

4.2 Remaining findings

No remaining findings.


FILE: font_replace.py
====================================================================================================
Applied fixes       : 2
Findings ERROR      : 0
Findings WARNING    : 0

4.1 Applied fixes

Line: 1
Rule: Add Qt5/Qt6-safe TS generation helper
Before:
    [missing helper]
After:
    def _qt_compat_build_ts_generator_command(...): ...

Line: 11
Rule: Remove local helper _qt_compat_build_ts_generator_command
Before:
    
    
    def _qt_compat_build_ts_generator_command():
        import shutil
        import sys
        from pathlib import Path
        from qgis.PyQt import QtCore
    
        qt_major = int(QtCore.QT_VERSION_STR.split(".")[0])
    
        if qt_major < 6:
            return [sys.executable, "-m", "PyQt5.pylupdate_main"]
    
        for candidate in ("lupdate", "lupdate6"):
            exe = shutil.which(candidate)
            if exe:
                return [exe]
    
        prefixes = [
            Path(sys.prefix),
            Path(sys.executable).resolve().parent,
            Path(sys.executable).resolve().parent.parent,
        ]
    
        possible = []
        for prefix in prefixes:
            possible.extend([
                prefix / "Library" / "bin" / "lupdate.exe",
                prefix / "bin" / "lupdate.exe",
                prefix / "apps" / "Qt6" / "bin" / "lupdate.exe",
                prefix / "apps" / "qt6" / "bin" / "lupdate.exe",
            ])
    
        for p in possible:
            if p.exists():
                return [str(p)]
    
        raise RuntimeError(
            "No Qt6-compatible lupdate tool was found. "
            "Under QGIS 4, PyQt5.pylupdate_main must not be used."
        )
    
    
After:
    

4.2 Remaining findings

No remaining findings.


FILE: MAJ_version_Qgis.py
====================================================================================================
Applied fixes       : 7
Findings ERROR      : 0
Findings WARNING    : 0

4.1 Applied fixes

Line: 1
Rule: Add Qt5/Qt6-safe TS generation helper
Before:
    [missing helper]
After:
    def _qt_compat_build_ts_generator_command(...): ...

Line: 1
Rule: Ajout/fusion import qt_compat pour alias MSGBOX_*
Before:
    [imports qt_compat avant ajout] manquants: MSGBOX_CANCEL
After:
    [imports qt_compat ajoutés/fusionnés] ajoutés: MSGBOX_CANCEL

Line: 26
Rule: Remove local helper _qt_compat_build_ts_generator_command
Before:
    
    
    def _qt_compat_build_ts_generator_command():
        import shutil
        import sys
        from pathlib import Path
        from qgis.PyQt import QtCore
    
        qt_major = int(QtCore.QT_VERSION_STR.split(".")[0])
    
        if qt_major < 6:
            return [sys.executable, "-m", "PyQt5.pylupdate_main"]
    
        for candidate in ("lupdate", "lupdate6"):
            exe = shutil.which(candidate)
            if exe:
                return [exe]
    
        prefixes = [
            Path(sys.prefix),
            Path(sys.executable).resolve().parent,
            Path(sys.executable).resolve().parent.parent,
        ]
    
        possible = []
        for prefix in prefixes:
            possible.extend([
                prefix / "Library" / "bin" / "lupdate.exe",
                prefix / "bin" / "lupdate.exe",
                prefix / "apps" / "Qt6" / "bin" / "lupdate.exe",
                prefix / "apps" / "qt6" / "bin" / "lupdate.exe",
            ])
    
        for p in possible:
            if p.exists():
                return [str(p)]
    
        raise RuntimeError(
            "No Qt6-compatible lupdate tool was found. "
            "Under QGIS 4, PyQt5.pylupdate_main must not be used."
        )
    
    
After:
    

Line: 58
Rule: Replace exec_() with exec()
Before:
    exec_
After:
    exec

Line: 60
Rule: Fallback DialogCode
Before:
    QDialog.Accepted
After:
    DIALOG_ACCEPTED

Line: 156
Rule: Enum/token replacement
Before:
    QMessageBox.Cancel
After:
    MSGBOX_CANCEL

Line: 160
Rule: Enum/token replacement
Before:
    QMessageBox.Cancel
After:
    MSGBOX_CANCEL

4.2 Remaining findings

No remaining findings.


FILE: metadata.txt
====================================================================================================
Applied fixes       : 4
Findings ERROR      : 0
Findings WARNING    : 0

4.1 Applied fixes

Line: 4
Rule: Update/reposition qgisMaximumVersion
Before:
    qgisMaximumVersion=3.99
After:
    qgisMaximumVersion = 4.99

Line: 5
Rule: Add supportsQt6 after qgisMaximumVersion
Before:
    [missing line]
After:
    supportsQt6 = True

Line: 7
Rule: Increment metadata version
Before:
    version=1.2.0
After:
    version = 1.2.1

Line: 18
Rule: Add metadata key: changelog
Before:
    [missing line]
After:
    changelog = 1.2.1 : Mise en conformité conjointe Qgis3/Qgis4 - Plugin scan_qt6_compat

4.2 Remaining findings

No remaining findings.


FILE: qgis4_to_qgis3.py
====================================================================================================
Applied fixes       : 2
Findings ERROR      : 0
Findings WARNING    : 0

4.1 Applied fixes

Line: 1
Rule: Add Qt5/Qt6-safe TS generation helper
Before:
    [missing helper]
After:
    def _qt_compat_build_ts_generator_command(...): ...

Line: 9
Rule: Remove local helper _qt_compat_build_ts_generator_command
Before:
    
    
    def _qt_compat_build_ts_generator_command():
        import shutil
        import sys
        from pathlib import Path
        from qgis.PyQt import QtCore
    
        qt_major = int(QtCore.QT_VERSION_STR.split(".")[0])
    
        if qt_major < 6:
            return [sys.executable, "-m", "PyQt5.pylupdate_main"]
    
        for candidate in ("lupdate", "lupdate6"):
            exe = shutil.which(candidate)
            if exe:
                return [exe]
    
        prefixes = [
            Path(sys.prefix),
            Path(sys.executable).resolve().parent,
            Path(sys.executable).resolve().parent.parent,
        ]
    
        possible = []
        for prefix in prefixes:
            possible.extend([
                prefix / "Library" / "bin" / "lupdate.exe",
                prefix / "bin" / "lupdate.exe",
                prefix / "apps" / "Qt6" / "bin" / "lupdate.exe",
                prefix / "apps" / "qt6" / "bin" / "lupdate.exe",
            ])
    
        for p in possible:
            if p.exists():
                return [str(p)]
    
        raise RuntimeError(
            "No Qt6-compatible lupdate tool was found. "
            "Under QGIS 4, PyQt5.pylupdate_main must not be used."
        )
    
    
After:
    

4.2 Remaining findings

No remaining findings.


FILE: version_dialog.py
====================================================================================================
Applied fixes       : 4
Findings ERROR      : 0
Findings WARNING    : 0

4.1 Applied fixes

Line: 1
Rule: Add Qt5/Qt6-safe TS generation helper
Before:
    [missing helper]
After:
    def _qt_compat_build_ts_generator_command(...): ...

Line: 11
Rule: Remove local helper _qt_compat_build_ts_generator_command
Before:
    
    
    def _qt_compat_build_ts_generator_command():
        import shutil
        import sys
        from pathlib import Path
        from qgis.PyQt import QtCore
    
        qt_major = int(QtCore.QT_VERSION_STR.split(".")[0])
    
        if qt_major < 6:
            return [sys.executable, "-m", "PyQt5.pylupdate_main"]
    
        for candidate in ("lupdate", "lupdate6"):
            exe = shutil.which(candidate)
            if exe:
                return [exe]
    
        prefixes = [
            Path(sys.prefix),
            Path(sys.executable).resolve().parent,
            Path(sys.executable).resolve().parent.parent,
        ]
    
        possible = []
        for prefix in prefixes:
            possible.extend([
                prefix / "Library" / "bin" / "lupdate.exe",
                prefix / "bin" / "lupdate.exe",
                prefix / "apps" / "Qt6" / "bin" / "lupdate.exe",
                prefix / "apps" / "qt6" / "bin" / "lupdate.exe",
            ])
    
        for p in possible:
            if p.exists():
                return [str(p)]
    
        raise RuntimeError(
            "No Qt6-compatible lupdate tool was found. "
            "Under QGIS 4, PyQt5.pylupdate_main must not be used."
        )
    
    
After:
    

Line: 76
Rule: Rewrite QDialogButtonBox standard buttons to qt_compat aliases
Before:
    QDialogButtonBox.Cancel
After:
    BUTTONBOX_CANCEL

Line: 76
Rule: Rewrite QDialogButtonBox standard buttons to qt_compat aliases
Before:
    QDialogButtonBox.Ok
After:
    BUTTONBOX_OK

4.2 Remaining findings

No remaining findings.


5. ANNEX - COMPACT REPLACEMENTS SUMMARY
----------------------------------------------------------------------------------------------------

Centralize lupdate helper : 5 -> remove local _qt_compat_build_ts_generator_command
DialogCode.Accepted : 1 -> DIALOG_ACCEPTED
QMessageBox.Cancel : 2 -> MSGBOX_CANCEL
Replace exec_() with exec() : 1 -> exec()
Rewrite QDialogButtonBox standard buttons to qt_compat aliases : 1 -> BUTTONBOX_CANCEL
Rewrite QDialogButtonBox standard buttons to qt_compat aliases : 1 -> BUTTONBOX_OK


====================================================================================================
PLUGIN RELOAD
====================================================================================================
Plugin reloaded: MAJ_version_Qgis
Python code was reloaded.
Plugin marked as enabled in QSettings: MAJ_version_Qgis
Plugin manager metadata reloaded. Close and reopen the Plugins window if it is already open.
UI refresh: processEvents OK | Main window refresh OK | Plugin manager interface update failed: 'QgsPluginManagerInterface' object has no attribute 'update'
If the Plugins window is already open, close and reopen it.
A QGIS restart may still be required for some fields in the plugin manager.
