Fix Qt6 compatibility issues#5254
Merged
Merged
Conversation
The YouTube integration changes introduced code that does not build on Qt6. The errors were: * void QLocale::setDefault(const QLocale &)': cannot convert argument 1 from 'QString' to 'const QLocale &' * no suitable user-defined conversion from "QString" to "const QLocale" exists This commit creates a new QLocale in place from a QString using the `QLocale(const QString &name)` constructor, and passing that QLocale to QLocale::setDefault.
Commit 60d95cb introduced some code that used the + operator on two Qt::Modifier items. Using a pipe operator instead fixes the compilation error on Qt5 and Qt6.
derrod
approved these changes
Sep 7, 2021
derrod
left a comment
Member
There was a problem hiding this comment.
Looks good to me, seems like the current code already doesn't conform to Qt's documentation so it probably only ever worked due to some deprecated feature.
WizardCM
approved these changes
Sep 7, 2021
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.
Description
There are two commits in this PR. One commit fixes a Qt6-incompatible call to QLocale::setDefault. The other commit fixes a Qt6-incompatible operator usage with two Qt::Modifier instances.
UI: Fix Qt6-incompatible call to QLocale::setDefault
The YouTube integration changes introduced code that does not build on Qt6. The errors were:
void QLocale::setDefault(const QLocale &)': cannot convert argument 1 from 'QString' to 'const QLocale &'
no suitable user-defined conversion from "QString" to "const QLocale" exists
This commit creates a new QLocale in place from a QString using the
QLocale(const QString &name)constructor, and passing that QLocale to QLocale::setDefault.UI: Fix Qt6-incompatible operator usage
Commit 60d95cb introduced some code that used the + operator on two Qt::Modifier items. Using a pipe operator instead fixes the compilation error on Qt5 and Qt6.
QLocale Docs:
The only docs regarding the Qt::Modifier operator I could find were in QKeySequence:
Motivation and Context
Maintain compatibility with both Qt5 and Qt6 to make switching between the two easier in the future.
Not an urgent fix since we still only support Qt5, so this does not need to be merged during the 27.1.0 RC phase.
How Has This Been Tested?
Clang-format CI check passed on my fork.
Built and tested Undo/Redo on Windows 10 against Qt 5.15.2 and Qt 6.2.0-beta3 to make sure the change to the modifier operator works with both Qt5 and Qt6.
May need testing for the change to the QLocale invocation.
Types of changes
Checklist: