-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: Use QRegularExpression only for Qt 5.5+ #3994
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,11 @@ | |
from qtpy.QtCore import QPoint, Qt | ||
from qtpy.QtGui import QCursor, QTextCursor, QTextDocument | ||
from qtpy.QtWidgets import QApplication, QToolTip | ||
from qtpy import PYQT5 | ||
from qtpy import QT_VERSION | ||
|
||
if PYQT5: | ||
QT55_VERSION = tuple(int(x) for x in QT_VERSION.split('.')) >= (5, 5) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe its cleaner to define
And use that in the conditions below? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm no, It's given an error due versions like 4.11.4 I'll implement: |
||
if QT55_VERSION: | ||
from qtpy.QtCore import QRegularExpression | ||
else: | ||
from qtpy.QtCore import QRegExp | ||
|
@@ -490,7 +492,7 @@ def find_text(self, text, changed=True, forward=True, case=False, | |
moves += [QTextCursor.End] | ||
if not regexp: | ||
text = re.escape(to_text_string(text)) | ||
if PYQT5: | ||
if QT55_VERSION: | ||
pattern = QRegularExpression(r"\b{}\b".format(text) if words else | ||
text) | ||
if case: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
check_version
fromutils/programs.py
to do the comparison here