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

PR: Try calling newer Qt methods first before falling back to deprecated/removed ones #186

Merged
merged 1 commit into from
Nov 25, 2021

Conversation

kumattau
Copy link
Contributor

@kumattau kumattau commented Nov 24, 2021

Hi,

This PR makes new APIs priority use than removed or deprecated APIs
to solves the following DeprecationWarnings of qtabrowser with QT_API=pyside2 or QT_API=pyside6.

QT_API=pyside2

qtawesome/icon_browser.py:125: DeprecationWarning: QDesktopWidget.screenNumber(const QPoint & arg__1) const is deprecated
  screen = desktop.screenNumber(desktop.cursor().pos())
qtawesome/qtawesome/icon_browser.py:126: DeprecationWarning: QDesktopWidget.screenGeometry(int screen) const is deprecated
  centerPoint = desktop.screenGeometry(screen).center()

QT_API=pyside6

qtawesome/icon_browser.py:273: DeprecationWarning: 'exec_' will be removed in the future. Use 'exec' instead.
  sys.exit(app.exec_())
  • exec_ function is handled as discussed in PySide6 DeprecationWarning of exec_ qtpy#286
  • Additionally, new set Filter Regular Expression is priority used than removed setFilterRegExp considering the possibility that PySide2/PyQt5 will report DeprecationWarning in the future.

I tested that this PR with the current master branch of QtPy (spyder-ide/qtpy@53ce7b0) reports no DeprecationWarning on the following environments.

PySide2                    5.15.2
PySide6                    6.2.1

PyQt5                      5.15.6
PyQt5-Qt5                  5.15.2
PyQt5-sip                  12.9.0
PyQt5-stubs                5.15.2.0

PyQt6                      6.2.0
PyQt6-Qt6                  6.2.0
PyQt6-sip                  13.1.0

pyqt                      5.9.2            py36h05f1152_2
qt                        5.9.7                h5867ecd_1
sip                       4.19.8           py36hf484d3e_0

@kumattau kumattau changed the title PR: Priority use of new APIs than removed or depricated APIs PR: Priority use of new APIs than removed or deprecated APIs Nov 24, 2021
@kumattau
Copy link
Contributor Author

I rebased onto master.

@ccordoba12 ccordoba12 added this to the v1.1.1 milestone Nov 24, 2021
@ccordoba12 ccordoba12 requested a review from dalthviz November 24, 2021 17:43
@CAM-Gerlach CAM-Gerlach changed the title PR: Priority use of new APIs than removed or deprecated APIs PR: Try calling newer Qt methods first before falling back to deprecated/removed ones Nov 24, 2021
Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kumattau thanks for the help with this! I left a question regarding the exec handling, otherwise this LGTM 👍

qtawesome/icon_browser.py Outdated Show resolved Hide resolved
@kumattau
Copy link
Contributor Author

kumattau commented Nov 25, 2021

Thank @dalthviz for review. I updated the commit.

  • keep sys.exit(app.exec_())
  • change commit message to PR title

Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kumattau ! LGTM 👍

@dalthviz dalthviz merged commit fddd26e into spyder-ide:master Nov 25, 2021
@kumattau kumattau deleted the new-api branch November 25, 2021 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants