Skip to content

Commit

Permalink
Try calling newer Qt methods first before falling back to deprecated/…
Browse files Browse the repository at this point in the history
…removed ones
  • Loading branch information
kumattau committed Nov 25, 2021
1 parent 8c23fa6 commit 90b595d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions qtawesome/icon_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ def __init__(self):
# Instead, QGuiApplication.screenAt(QPoint) is supported
# in Qt 5.10 or later.
try:
screen = QtGui.QGuiApplication.screenAt(QtGui.QCursor.pos())
centerPoint = screen.geometry().center()
except AttributeError:
desktop = QtWidgets.QApplication.desktop()
screen = desktop.screenNumber(desktop.cursor().pos())
centerPoint = desktop.screenGeometry(screen).center()
except AttributeError:
screen = QtGui.QGuiApplication.screenAt(QtGui.QCursor.pos())
centerPoint = screen.geometry().center()

geo.moveCenter(centerPoint)
self.setGeometry(geo)
Expand Down Expand Up @@ -159,9 +159,9 @@ def _updateFilter(self):
# Instead, QSortFilterProxyModel.setFilterRegularExpression is
# supported in Qt 5.12 or later.
try:
self._proxyModel.setFilterRegExp(reString)
except AttributeError:
self._proxyModel.setFilterRegularExpression(reString)
except AttributeError:
self._proxyModel.setFilterRegExp(reString)

def _triggerDelayedUpdate(self):
"""
Expand Down

0 comments on commit 90b595d

Please sign in to comment.