Skip to content
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

chore: silence some deprecation warnings in Qt 6.8 #5529

Merged
merged 2 commits into from
Aug 4, 2024

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Aug 3, 2024

The underlying deprecations aren't new, but they haven't shown up as a warning in 6.7 and below.

Notably, the variant conversion/checking in controllers/filters/lang/Types.hpp was quite vocal (seems to be included in most files; transitively). QVariant::type is deprecated (typeId is preferred) in Qt 6, but there's no alternative in Qt 5. Furthermore, QMetaType::Type contains predefined type-ids, while a type-id is of type int (in both Qt 5 and 6). This isn't really relevant for us, since we don't use user-types.

Some other changes:

  • QVariant::canConvert<T> is preferred over QVariant::canConvert(type-id)
  • QString::fromUcs4 prefers the char32_t overload (available in Qt 5)
  • Prefer std::as_const over qAsConst (but we don't need either)
  • QRegularExpression got a matchView in 6.5 which is preferred over match for string views to avoid allocating a string
  • QDateTime::setTimeSpec is deprecated (use setTimeZone - that's what setTimeSpec does under the hood too)

There are two other deprecations that are now reported which don't have a Qt 5 equivalent:

  • QMouseEvent::{screenPos, globalPos} are deprecated, and globalPosition should be used (not in Qt 5)
  • QWidget::addAction: use addAction(text, shortcut, object, slot) instead (not in Qt 5 and these methods are on QMenu in Qt 5)

Otherwise, Qt 6.8 seems to work good enough on Windows. The only compilation error was that QFile(path) is now explicit (fixed in https://github.com/Chatterino/chatterino2/pull/5527/files#diff-07c979414bf7268bd34c32515e8500e25726e4ed1d43eb970f45bacff76b5bf3R111).

@pajlada pajlada merged commit 3257da1 into Chatterino:master Aug 4, 2024
17 checks passed
@Nerixyz Nerixyz deleted the fix/qt-6-8 branch August 4, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants