-
Notifications
You must be signed in to change notification settings - Fork 445
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
[Building/Packaging] Support for Qt 6.8 (currently beta) #1055
Comments
Closing until 6.8 gets released, because this might just be a mistake on Qt's part, because the documentation still says that there should be a constructor QChar(int), which is missing in the beta leading to this error. |
Further investigation revealed that the constructor |
Final post-mortem: The macro |
This is solved with the merging of the related PR. |
Describe the problem
While checking for versions to reproduce bugs (or see if they are resolved), I also checked the current 6.8.0beta3 (in kde-unstable). This failed to build with
error: conversion from ‘int’ to ‘QChar’ is ambiguous
in several places.KEYBT
takes in a QChar (see here), while the declaration ofKEYBTDECL
is used with ahex-literal
(see here), requiring an implicit conversion fromint
toQChar
. Every invocation ofKEYBT
is affected, totaling 240 calls in the Linux code and another 236 in the Windows code.I expect this behaviour to be also in 6.8.0.
Investigation
The issue stems from the removal of the
QT_IMPLICIT_QCHAR_CONSTRUCTION
macro (which is used in both Linux and Windows versions): qt/qtbase@54f222. This means that aQChar
can only be constructed explicitly from anint
, whereas before (in Qt5, and Qt6 with the macro), an implicit conversion was allowed. Since 6.0, most constructors taking integers are explicit "to avoid dangerous mistakes when accidentally mixing integral types and strings." Until 6.8, this behaviour could be disabled viaQT_IMPLICIT_QCHAR_CONSTRUCTION
, but not anymore.Versions
Provide version information for all components and libraries.
dev
Build commands
I'm using the
cmake
community build for Arch Linux, thoughqmake
should be similarly affected. Full instructions: PKGBUILDError messages
There is a much clearer error at the beginning:
It refers to qt/qtbase:src/corelib/text/qchar.h. The errors if the macro is removed look like this:
Suggestions, solutions
Since it's a preprocessor directive, there isn't much typing, though it might be possible tostatic_cast
theint
tochar
or something.To keep the current behaviour, an explicit cast (using
static_cast<int>()
or similar) might be the best approach.Explicitly call the QChar constructor
QChar(...)
instead of relying on C++ conversions.The text was updated successfully, but these errors were encountered: