COMP/PERF: Qt deprecation fixes and range-loop detach prevention - #1382
Conversation
|
@jamesobutler making smaller PRs to make these easier to review. These are all part of the same effort in #1372 |
jamesobutler
left a comment
There was a problem hiding this comment.
COMP: Replace deprecated QImage::mirrored() with flipped()
Qt 6.9 deprecated QImage::mirrored() in favor of flipped(Qt::Orientations).
Use #if QT_VERSION guards to select the appropriate API while maintaining
Qt5 compatibility.
^Not sure if you care to change the logic, or just make a note in the commit message, but mirrored() was marked deprecated in Qt 6.9, but then changed in Qt 6.10 to indicate that it was now scheduled for deprecation starting with Qt 6.13, thereby un-deprecating it for a bit. See qt/qtbase@0aa07ce
…dFilterChange Qt 6.10 deprecated QSortFilterProxyModel::invalidateFilter() in favor of the beginFilterChange()/endFilterChange() pair. Use #if QT_VERSION guards to select the appropriate API while maintaining Qt5 and Qt6 <6.10 compat. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lity QImage::flipped(Qt::Orientations) was introduced in Qt 6.9. While QImage::mirrored() was briefly annotated as deprecated in Qt 6.9 and then un-deprecated in Qt 6.10 (scheduled for removal from Qt 6.13), the newer flipped() API is clearer in intent and is the recommended replacement going forward. Use #if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0) guards to select the appropriate API while maintaining Qt5 compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
• Requires explicit declaration of the enum in Q_ENUMS(...). • Does not support compile-time introspection via QMetaEnum::fromType<T>(). • Print conversions via qDebug() or QVariant conversions not automatically supported. • Replace all Q_ENUMS(...) with Q_ENUM(...) in your QObject classes. • Make sure the enum is declared immediately before the Q_ENUM macro. • After migration, there is seamless integration into Qt’s meta-object system, better introspection, and compatibility with modern Qt5 (5.5+) and Qt6.
Use std::as_const() or const local variables to ensure range-for loops call the const begin()/end() overloads, avoiding unnecessary COW detach on implicitly shared Qt containers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
797049c to
e276b2f
Compare
|
Thanks for the detailed review @jamesobutler! Addressed all three points:
Force-pushed to |
Summary
QAbstractItemModel::invalidateFilter()withbeginFilterChange()/endFilterChange()(Qt 6.0+)QImage::mirrored()withflipped()(Qt 6.0+)Q_ENUMSwithQ_ENUM(deprecated since Qt 5.5)std::as_const()(clazyrange-loop-detach)These are the first four commits from #1372 extracted for focused review.
Test plan
🤖 Generated with Claude Code