fix: Restore case-insensitive search in File Open for PySide2 with QtCore5#174
Open
kikeda-falcons wants to merge 1 commit intoshotgunsoftware:masterfrom
Conversation
…ression as appropriate Update the create_case_insensitive_regex utility to handle Qt5 and Qt6 differences more robustly. Since Qt6 removed QRegExp and reorganized QRegularExpression flag enums, the function now checks the Qt major version to select the correct API. For Qt5, it uses QRegExp with FixedString syntax for literal string matching. For Qt6+, it uses QRegularExpression with CaseInsensitiveOption set via setPatternOptions. This ensures consistent, case-insensitive, literal matching regardless of Qt version. The docstring was updated to clarify this logic.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #174 +/- ##
==========================================
+ Coverage 32.36% 32.38% +0.01%
==========================================
Files 68 68
Lines 7671 7671
==========================================
+ Hits 2483 2484 +1
+ Misses 5188 5187 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restores case-insensitive search behavior in the File Open dialog when running under PySide2 with Qt5 (e.g., Maya 2022).
This resolves Issue #173.
The fix corrects version detection and aligns regex construction with the appropriate Qt API for each major version.
Problem
Case-insensitive search stopped working in Maya environments that ship with PySide2 + Qt5. Filters behaved inconsistently depending on the Qt binding, particularly under newer Maya versions.
Root Cause
The regex creation logic attempted to infer API behavior by checking for the presence of
QtCore.QRegularExpression.This approach is unreliable because:
QRegularExpressionexists in Qt5, but its flag handling differs from Qt6.QRegExpentirely and reorganizedQRegularExpressionflag enums.As documented in Qt 5.15 (QRegularExpression API reference), Qt5 exposes
QRegularExpressionand its flag enums viaQtCore, but its behavior and preferred usage differ from Qt6.Solution
Use the Qt major version to determine which regex API to construct, instead of checking for attribute existence.
Qt5
QRegExpFixedStringsyntaxQt.CaseInsensitiveQt6+
QRegularExpressionCaseInsensitiveOptionviasetPatternOptionsQRegExp)This makes the behavior explicit, version-correct, and stable across Maya 2022–2026.
Changes