Conversation
setNamedColor is deprecated starting with Qt 6.4. There is one instance where `colorOnLightBackground` is redefined in a separate scope, making it a noop. This has been corrected.
Qt provides qAsConst to avoid detaching and thus reduce copying. C++17 introduces std::as_const which has the same effect and is the recommended replacement by Qt.
Git history doesn't go far enough to determine why this call exists; it's at least 13 years old. This section of code hasn't ever changed. It's reasonable to assume that it's a typo (maybe first implementation attempt) and the compiler just didn't warn about it, so it was overlooked. Now the compiler warns about it.
Calling `reserve()` without arguments is deprecated in C++20. It is equivalent to `shrink_to_fit()` which is also available in C++17.
QString::count() without arguments is deprecated with Qt 6.4. count() is equivalent to size() and length(); the latter is chosen as replacement. It conveys a sense of ordering.
`associatedWidgets` is deprecated since Qt 6.0. Qt 6.0 instead introduced `associatedObjects` which more generally returns QObject rather than QWidget. The remaining logic stays the same, using qobject_cast to get the correct instances. For simplicity, the variable names stay unchanged.
Qt 6.0 changed to QSinglePointEvent and thus has a changed interface. In particular, the pos() function has been renamed to position(). Qt 6.4 deprecates the constructor for QMouseEvent without global positioning, so add the global position to the constructor.
|
To check compatibility of this patch with various versions of gcc, ffmpeg and Qt, I created a project on the openSUSE build service to build the current The So my conclusion: I support merging this PR, as it removes deprecations and improves compatibility with current and future Qt versions. |
letsfindaway
left a comment
There was a problem hiding this comment.
I also reviewed the changes manually and did not find any problems. I therefore approve this PR.
|
@letsfindaway Thanks for having a look. While testing on my system, I've made sure to be as compatible as possible and keep the changes small. Great to see that the documentation for Qt and C++ is actually accurate 😄 |
Similar warnings are grouped into commits. If there are questions or suggestions, you may comment below, so we can discuss them. The solutions are based on the compiler recommendations.
Where changes cannot be made cross-compatible, they are version gated (mostly concerns Qt 6 vs Qt 5). Some warnings remain that are a bit more involved (mainly around FFmpeg and OpenSSL/MD5).
Run on Arch Linux with Qt 6.7.1 and C++20 on GCC 14.1.1.