AttributeError: 'QAction' object has no attribute 'setShortcutVisibleInContextMenu'

Issue #286 closed
Javier Navarro created an issue

This is the same error as issue #276. I followed Benjamin’s recommendation to upgrade to QGIS 3.8 but the issue persists. I’m providing here further info on my environment.

enmapboxgui.py", line 105, in init self.setupUi(self) File "", line 252, in setupUi AttributeError: 'QAction' object has no attribute 'setShortcutVisibleInContextMenu'

Environment:

QGIS version 3.8.2-Zanzibar QGIS code revision ff5d718b9a Compiled against Qt 5.9.5 Running against Qt 5.9.5 Compiled against GDAL/OGR 2.4.2 Running against GDAL/OGR 2.4.2 Compiled against GEOS 3.7.1-CAPI-1.11.1 Running against GEOS 3.7.1-CAPI-1.11.1 27a5e771 PostgreSQL Client Version 10.10 (Ubuntu 10.10-0ubuntu0.18.04.1) SpatiaLite Version 4.3.0a QWT Version 6.1.3 QScintilla2 Version 2.10.2 Compiled against PROJ 5.2.0 Running against PROJ Rel. 5.2.0, September 15th, 2018 This copy of QGIS writes debugging output. OS Version Ubuntu 18.04.2 LTS

Comments (7)

  1. Benjamin Jakimow

    You need a QGIS that is compiled against Qt 5.10 or higher.

    The following example needs to run in your QGIS python shell:

    from qgis.PyQt.QtWidgets import QAction
    action = QAction('test action')
    # the critical line, not available before Qt 5.10
    action.setShortcutVisibleInContextMenu(True)
    

  2. Javier Navarro reporter

    Thanks Benjamin, that’s a good lead for me to follow. I wonder why the latest QGIS for Ubuntu 18.04 has not been compiled against Qt 5.10 or higher. Do you think it’d have something to do with the Qt version that comes with my distribution? If so (and seeing as I already have the latest QGIS installed) I wonder if the issue is I need a newer distribution?

    Thanks

    Javi

  3. Javier Navarro reporter

    Just a note for others: The version of Qt that QGIS uses (in Linux) will be dependent on your system’s qt5-default library. This default cannot be easily updated as it’s not a regular apt installed package (nor should it be tinkered with according to others). In Ubuntu 18.04 (bionic) qt5-default is 5.9.5. This means EnMap-Box will not be able to start the GUI. So the statement that we should install a version of QGIS that uses Qt 5.10 or above can be a bit misleading because Qt version is predetermined by your OS.

    If you have the capacity to update Ubuntu to 19.04 then that should sort out the issue. Unfortunately for people working on enterprise systems, there can be a lag between what IT departments adopt and the latest version of operating systems, and updating may not be possible. One option is to install a previous version of EnMap-Box, but I don’t believe that’s an acceptable solution hence I haven’t tested it. Another option is to move to Windows and install through OsGeoW. That’s worked for me.

  4. Benjamin Jakimow

    @Javier Navarro I reopened this issue as I think I might have a working solution for.

    The make/deploy.py script that builds the EnMAP-Box plugin zip (which is uploaded to the QGIS plugin repository) now removes the critical part from all *.ui files:

    Critical action/property part that is not working from Qt < 5.10:

      <action>
      ....
       <property name="shortcutVisibleInContextMenu">
        <bool>true</bool>
       </property>
      </action>
    

    This seems to work well under Qt 5.10+. However, I haven’t tested it so far on Linux and the CI tests need to be adapted to as well.

  5. Log in to comment