Fix Qt::AA_DontUseNativeMenuWindows being unsettable on 32 bit systems
f1bb9cfbf65ab56b67b5a52fa736071e0e534261 added this value, but it was only when a test in qtdeclarative tried to use it that it was discovered that it couldn't be set on 32 bit operating systems (armv7, AKA imx7) due to overflow as a result of the bit shifting that is done. Fix it by using an old, deprecated value. If any old codebase using that older flag tries to build against a newer Qt with this change, it shouldn't affect it, as setting the flag does nothing in Widgets, and native menus didn't exist in earlier versions. Task-number: QTBUG-69558 Change-Id: I520154d02e9ccf007ebd73807685212a19fbee1b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
8424a64014
commit
907181cb21
@ -431,7 +431,7 @@ namespace Qt {
|
||||
AA_MacDontSwapCtrlAndMeta = 7,
|
||||
AA_Use96Dpi = 8,
|
||||
AA_DisableNativeVirtualKeyboard = 9,
|
||||
// AA_X11InitThreads = 10,
|
||||
AA_DontUseNativeMenuWindows = 10,
|
||||
AA_SynthesizeTouchForUnhandledMouseEvents = 11,
|
||||
AA_SynthesizeMouseForUnhandledTouchEvents = 12,
|
||||
#if QT_DEPRECATED_SINCE(6, 0)
|
||||
@ -463,7 +463,6 @@ namespace Qt {
|
||||
AA_CompressTabletEvents = 29,
|
||||
// AA_DisableWindowContextHelpButton = 30,
|
||||
AA_DisableSessionManager = 31,
|
||||
AA_DontUseNativeMenuWindows = 32,
|
||||
|
||||
// Add new attributes before this line
|
||||
AA_AttributeCount
|
||||
|
@ -1108,6 +1108,57 @@ void tst_QCoreApplication::testDeleteLaterFromBeforeOutermostEventLoop()
|
||||
QVERIFY(!spyPointer);
|
||||
}
|
||||
|
||||
void tst_QCoreApplication::setIndividualAttributes_data()
|
||||
{
|
||||
QTest::addColumn<Qt::ApplicationAttribute>("attribute");
|
||||
|
||||
const QMetaEnum &metaEnum = Qt::staticMetaObject.enumerator(Qt::staticMetaObject.indexOfEnumerator("ApplicationAttribute"));
|
||||
// - 1 to avoid AA_AttributeCount.
|
||||
for (int i = 0; i < metaEnum.keyCount(); ++i) {
|
||||
const auto attribute = static_cast<Qt::ApplicationAttribute>(metaEnum.value(i));
|
||||
if (attribute == Qt::AA_AttributeCount)
|
||||
continue;
|
||||
|
||||
QTest::addRow("%s", metaEnum.key(i)) << attribute;
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QCoreApplication::setIndividualAttributes()
|
||||
{
|
||||
QFETCH(Qt::ApplicationAttribute, attribute);
|
||||
|
||||
const auto originalValue = QCoreApplication::testAttribute(attribute);
|
||||
auto cleanup = qScopeGuard([=]() {
|
||||
QCoreApplication::setAttribute(attribute, originalValue);
|
||||
});
|
||||
|
||||
QCoreApplication::setAttribute(attribute, true);
|
||||
QVERIFY(QCoreApplication::testAttribute(attribute));
|
||||
|
||||
QCoreApplication::setAttribute(attribute, false);
|
||||
QVERIFY(!QCoreApplication::testAttribute(attribute));
|
||||
}
|
||||
|
||||
void tst_QCoreApplication::setMultipleAttributes()
|
||||
{
|
||||
const auto originalDontUseNativeMenuWindowsValue = QCoreApplication::testAttribute(Qt::AA_DontUseNativeMenuWindows);
|
||||
const auto originalDisableSessionManagerValue = QCoreApplication::testAttribute(Qt::AA_DisableSessionManager);
|
||||
auto cleanup = qScopeGuard([=]() {
|
||||
QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuWindows, originalDontUseNativeMenuWindowsValue);
|
||||
QCoreApplication::setAttribute(Qt::AA_DisableSessionManager, originalDisableSessionManagerValue);
|
||||
});
|
||||
|
||||
QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuWindows, true);
|
||||
QCoreApplication::setAttribute(Qt::AA_DisableSessionManager, true);
|
||||
QVERIFY(QCoreApplication::testAttribute(Qt::AA_DontUseNativeMenuWindows));
|
||||
QVERIFY(QCoreApplication::testAttribute(Qt::AA_DisableSessionManager));
|
||||
|
||||
QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuWindows, false);
|
||||
QCoreApplication::setAttribute(Qt::AA_DisableSessionManager, false);
|
||||
QVERIFY(!QCoreApplication::testAttribute(Qt::AA_DontUseNativeMenuWindows));
|
||||
QVERIFY(!QCoreApplication::testAttribute(Qt::AA_DisableSessionManager));
|
||||
}
|
||||
|
||||
#ifndef QT_QGUIAPPLICATIONTEST
|
||||
QTEST_APPLESS_MAIN(tst_QCoreApplication)
|
||||
#endif
|
||||
|
@ -46,6 +46,9 @@ private slots:
|
||||
#endif
|
||||
void theMainThread();
|
||||
void testDeleteLaterFromBeforeOutermostEventLoop();
|
||||
void setIndividualAttributes_data();
|
||||
void setIndividualAttributes();
|
||||
void setMultipleAttributes();
|
||||
};
|
||||
|
||||
#endif // TST_QCOREAPPLICATION_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user