Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: unsupported operand type(s) for +: 'Modifier' and 'Key' #60063

Open
2 tasks done
nicogodet opened this issue Jan 6, 2025 · 4 comments
Open
2 tasks done

TypeError: unsupported operand type(s) for +: 'Modifier' and 'Key' #60063

nicogodet opened this issue Jan 6, 2025 · 4 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@nicogodet
Copy link
Member

What is the bug or the crash?

image

Steps to reproduce the issue

  1. Open processing panel
  2. Script -> Create new script

Versions

OSGeo4w Qt6

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

@nicogodet nicogodet added Processing Relating to QGIS Processing framework or individual Processing algorithms Bug Either a bug report, or a bug fix. Let's hope for the latter! labels Jan 6, 2025
@nicogodet
Copy link
Member Author

QKeySequence(Qt.Modifier.CTRL | Qt.Key.Key_Space) fixes it
But I'm not confident about backward compat...

@agiudiceandrea
Copy link
Contributor

@nicogodet, I've tested QKeySequence(Qt.Modifier.CTRL | Qt.Key.Key_Space) with QGIS built against Qt5 and it looks like it works without issues.

Qt.Modifier.CTRL + Qt.Key.Key_Space # -> 67108896
Qt.Modifier.CTRL | Qt.Key.Key_Space # -> 67108896

@nicogodet
Copy link
Member Author

nicogodet commented Jan 7, 2025

@agiudiceandrea My concerns are for Python version rather than Qt
| comes with python 3.10+ AFAIK and Python min version for QGIS is 3.9

Seems I'm wrong...

Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt6.QtCore import Qt
>>> Qt.Modifier.CTRL + Qt.Key.Key_Space
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'Modifier' and 'Key'
>>> Qt.Modifier.CTRL | Qt.Key.Key_Space
<PyQt6.QtCore.QKeyCombination object at 0x000001700C7F7890>
>>>

@agiudiceandrea
Copy link
Contributor

I've also done the test using Python 3.9.5 on Windows with Qt5 (OSGeo4W):

Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5.QtCore import Qt
>>> Qt.Modifier.CTRL + Qt.Key.Key_Space
67108896
>>> Qt.Modifier.CTRL | Qt.Key.Key_Space
67108896

Not sure if we can rely on such tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

2 participants