Stop using mixed enum arithmetic
It's deprecated. Port some unnamed enumerations (used only to declare constants) to constexpr integers instead. Apply qToUnderlying as needed. Task-number: QTBUG-94059 Change-Id: Ifaa64ece966ce08df40dc71ffcfa7ac038110e0b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
e650ea323f
commit
4059af81d3
@ -1155,17 +1155,17 @@ static const ushort mapIdFromQt3ToCurrent[MapFromThreeCount] =
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// enum values needed to map Qt5 based type id's to Qt6 based ones
|
// values needed to map Qt5 based type id's to Qt6 based ones
|
||||||
enum Qt5Types {
|
constexpr int Qt5UserType = 1024;
|
||||||
Qt5UserType = 1024,
|
constexpr int Qt5LastCoreType = QMetaType::QCborMap;
|
||||||
Qt5LastCoreType = QMetaType::QCborMap,
|
constexpr int Qt5FirstGuiType = 64;
|
||||||
Qt5FirstGuiType = 64,
|
constexpr int Qt5LastGuiType = 87;
|
||||||
Qt5LastGuiType = 87,
|
constexpr int Qt5SizePolicy = 121;
|
||||||
Qt5SizePolicy = 121,
|
constexpr int Qt5RegExp = 27;
|
||||||
Qt5RegExp = 27,
|
constexpr int Qt5KeySequence = 75;
|
||||||
Qt5KeySequence = 75,
|
constexpr int Qt5QQuaternion = 85;
|
||||||
Qt5QQuaternion = 85
|
|
||||||
};
|
constexpr int Qt6ToQt5GuiTypeDelta = qToUnderlying(QMetaType::FirstGuiType) - Qt5FirstGuiType;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Internal function for loading a variant from stream \a s. Use the
|
Internal function for loading a variant from stream \a s. Use the
|
||||||
@ -1205,7 +1205,7 @@ void QVariant::load(QDataStream &s)
|
|||||||
if (typeId == Qt5UserType) {
|
if (typeId == Qt5UserType) {
|
||||||
typeId = QMetaType::User;
|
typeId = QMetaType::User;
|
||||||
} else if (typeId >= Qt5FirstGuiType && typeId <= Qt5LastGuiType) {
|
} else if (typeId >= Qt5FirstGuiType && typeId <= Qt5LastGuiType) {
|
||||||
typeId += QMetaType::FirstGuiType - Qt5FirstGuiType;
|
typeId += Qt6ToQt5GuiTypeDelta;
|
||||||
} else if (typeId == Qt5SizePolicy) {
|
} else if (typeId == Qt5SizePolicy) {
|
||||||
typeId = QMetaType::QSizePolicy;
|
typeId = QMetaType::QSizePolicy;
|
||||||
} else if (typeId == Qt5RegExp) {
|
} else if (typeId == Qt5RegExp) {
|
||||||
@ -1273,7 +1273,7 @@ void QVariant::save(QDataStream &s) const
|
|||||||
typeId = Qt5UserType;
|
typeId = Qt5UserType;
|
||||||
saveAsUserType = true;
|
saveAsUserType = true;
|
||||||
} else if (typeId >= QMetaType::FirstGuiType && typeId <= QMetaType::LastGuiType) {
|
} else if (typeId >= QMetaType::FirstGuiType && typeId <= QMetaType::LastGuiType) {
|
||||||
typeId -= QMetaType::FirstGuiType - Qt5FirstGuiType;
|
typeId -= Qt6ToQt5GuiTypeDelta;
|
||||||
if (typeId > Qt5LastGuiType) {
|
if (typeId > Qt5LastGuiType) {
|
||||||
typeId = Qt5UserType;
|
typeId = Qt5UserType;
|
||||||
saveAsUserType = true;
|
saveAsUserType = true;
|
||||||
|
@ -76,17 +76,15 @@ QT_BEGIN_NAMESPACE
|
|||||||
Date/Time Constants
|
Date/Time Constants
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
enum : qint64 {
|
constexpr qint64 SECS_PER_DAY = 86400;
|
||||||
SECS_PER_DAY = 86400,
|
constexpr qint64 MSECS_PER_DAY = 86400000;
|
||||||
MSECS_PER_DAY = 86400000,
|
constexpr qint64 SECS_PER_HOUR = 3600;
|
||||||
SECS_PER_HOUR = 3600,
|
constexpr qint64 MSECS_PER_HOUR = 3600000;
|
||||||
MSECS_PER_HOUR = 3600000,
|
constexpr qint64 SECS_PER_MIN = 60;
|
||||||
SECS_PER_MIN = 60,
|
constexpr qint64 MSECS_PER_MIN = 60000;
|
||||||
MSECS_PER_MIN = 60000,
|
constexpr qint64 MSECS_PER_SEC = 1000;
|
||||||
MSECS_PER_SEC = 1000,
|
constexpr qint64 TIME_T_MAX = std::numeric_limits<time_t>::max();
|
||||||
TIME_T_MAX = std::numeric_limits<time_t>::max(),
|
constexpr qint64 JULIAN_DAY_FOR_EPOCH = 2440588; // result of julianDayFromDate(1970, 1, 1)
|
||||||
JULIAN_DAY_FOR_EPOCH = 2440588 // result of julianDayFromDate(1970, 1, 1)
|
|
||||||
};
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
QDate static helper functions
|
QDate static helper functions
|
||||||
|
@ -52,7 +52,7 @@ static int qt_palette_count = 1;
|
|||||||
|
|
||||||
static constexpr QPalette::ResolveMask colorRoleOffset(QPalette::ColorGroup colorGroup)
|
static constexpr QPalette::ResolveMask colorRoleOffset(QPalette::ColorGroup colorGroup)
|
||||||
{
|
{
|
||||||
return QPalette::NColorRoles * colorGroup;
|
return qToUnderlying(QPalette::NColorRoles) * qToUnderlying(colorGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr QPalette::ResolveMask bitPosition(QPalette::ColorGroup colorGroup,
|
static constexpr QPalette::ResolveMask bitPosition(QPalette::ColorGroup colorGroup,
|
||||||
|
@ -71,10 +71,8 @@ Q_LOGGING_CATEGORY(lcQtGuiDrawHelper, "qt.gui.drawhelper")
|
|||||||
constants and structures
|
constants and structures
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum {
|
constexpr int fixed_scale = 1 << 16;
|
||||||
fixed_scale = 1 << 16,
|
constexpr int half_point = 1 << 15;
|
||||||
half_point = 1 << 15
|
|
||||||
};
|
|
||||||
|
|
||||||
template <QPixelLayout::BPP bpp> static
|
template <QPixelLayout::BPP bpp> static
|
||||||
inline uint QT_FASTCALL fetch1Pixel(const uchar *, int)
|
inline uint QT_FASTCALL fetch1Pixel(const uchar *, int)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user