Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"
This commit is contained in:
commit
47b2cde5dc
|
@ -1384,7 +1384,8 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru
|
||||||
QQmlPropertyData::DontRemoveBinding);
|
QQmlPropertyData::DontRemoveBinding);
|
||||||
if (!b->isValueTypeProxy()) {
|
if (!b->isValueTypeProxy()) {
|
||||||
QQmlBinding *binding = static_cast<QQmlBinding*>(b.data());
|
QQmlBinding *binding = static_cast<QQmlBinding*>(b.data());
|
||||||
if (!binding->hasError() && !binding->hasDependencies())
|
if (!binding->hasError() && !binding->hasDependencies()
|
||||||
|
&& binding->context() && !binding->context()->unresolvedNames)
|
||||||
b->removeFromObject();
|
b->removeFromObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2656,10 +2656,10 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index)
|
||||||
model->m_cacheMetaType->initializePrototype();
|
model->m_cacheMetaType->initializePrototype();
|
||||||
QV4::ExecutionEngine *v4 = model->m_cacheMetaType->v4Engine;
|
QV4::ExecutionEngine *v4 = model->m_cacheMetaType->v4Engine;
|
||||||
QV4::Scope scope(v4);
|
QV4::Scope scope(v4);
|
||||||
|
++cacheItem->scriptRef;
|
||||||
QV4::ScopedObject o(scope, v4->memoryManager->allocate<QQmlDelegateModelItemObject>(cacheItem));
|
QV4::ScopedObject o(scope, v4->memoryManager->allocate<QQmlDelegateModelItemObject>(cacheItem));
|
||||||
QV4::ScopedObject p(scope, model->m_cacheMetaType->modelItemProto.value());
|
QV4::ScopedObject p(scope, model->m_cacheMetaType->modelItemProto.value());
|
||||||
o->setPrototypeOf(p);
|
o->setPrototypeOf(p);
|
||||||
++cacheItem->scriptRef;
|
|
||||||
|
|
||||||
return QQmlV4Handle(o);
|
return QQmlV4Handle(o);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
#include <QtCore/qlist.h>
|
#include <QtCore/qlist.h>
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
#include <QtCore/qelapsedtimer.h>
|
#include <QtCore/qelapsedtimer.h>
|
||||||
|
#include <QtCore/qpointer.h>
|
||||||
|
|
||||||
#if QT_CONFIG(quick_shadereffect)
|
#if QT_CONFIG(quick_shadereffect)
|
||||||
#include <QtQuick/private/qquickshadereffectsource_p.h>
|
#include <QtQuick/private/qquickshadereffectsource_p.h>
|
||||||
|
@ -682,12 +683,12 @@ public:
|
||||||
: leftSet(false), rightSet(false), upSet(false), downSet(false),
|
: leftSet(false), rightSet(false), upSet(false), downSet(false),
|
||||||
tabSet(false), backtabSet(false) {}
|
tabSet(false), backtabSet(false) {}
|
||||||
|
|
||||||
QQuickItem *left = nullptr;
|
QPointer<QQuickItem> left;
|
||||||
QQuickItem *right = nullptr;
|
QPointer<QQuickItem> right;
|
||||||
QQuickItem *up = nullptr;
|
QPointer<QQuickItem> up;
|
||||||
QQuickItem *down = nullptr;
|
QPointer<QQuickItem> down;
|
||||||
QQuickItem *tab = nullptr;
|
QPointer<QQuickItem> tab;
|
||||||
QQuickItem *backtab = nullptr;
|
QPointer<QQuickItem> backtab;
|
||||||
bool leftSet : 1;
|
bool leftSet : 1;
|
||||||
bool rightSet : 1;
|
bool rightSet : 1;
|
||||||
bool upSet : 1;
|
bool upSet : 1;
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
pragma Singleton
|
||||||
|
import QtQml 2.0
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
property string name
|
||||||
|
property string category
|
||||||
|
property string sound
|
||||||
|
property int size: Animal.SizeSmall
|
||||||
|
|
||||||
|
enum SizeType {
|
||||||
|
SizeSmall,
|
||||||
|
SizeMedium,
|
||||||
|
SizeLarge
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
module dumper.CompositeWithEnum
|
||||||
|
singleton Animal 1.0 Animal.qml
|
||||||
|
depends QtQml 2.0
|
|
@ -46,6 +46,7 @@ private slots:
|
||||||
void builtins();
|
void builtins();
|
||||||
void singleton();
|
void singleton();
|
||||||
void compositeWithinSingleton();
|
void compositeWithinSingleton();
|
||||||
|
void compositeWithEnum();
|
||||||
|
|
||||||
void plugin_data();
|
void plugin_data();
|
||||||
void plugin();
|
void plugin();
|
||||||
|
@ -135,6 +136,21 @@ void tst_qmlplugindump::compositeWithinSingleton()
|
||||||
QVERIFY2(result.contains(QLatin1String("exportMetaObjectRevisions: [0]")), qPrintable(result));
|
QVERIFY2(result.contains(QLatin1String("exportMetaObjectRevisions: [0]")), qPrintable(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_qmlplugindump::compositeWithEnum()
|
||||||
|
{
|
||||||
|
QProcess dumper;
|
||||||
|
QStringList args;
|
||||||
|
args << QLatin1String("dumper.CompositeWithEnum") << QLatin1String("1.0")
|
||||||
|
<< QLatin1String(QT_QMLTEST_DIR "/data");
|
||||||
|
dumper.start(qmlplugindumpPath, args);
|
||||||
|
QVERIFY2(dumper.waitForStarted(), qPrintable(dumper.errorString()));
|
||||||
|
QVERIFY2(dumper.waitForFinished(), qPrintable(dumper.errorString()));
|
||||||
|
|
||||||
|
const QString &result = dumper.readAllStandardOutput();
|
||||||
|
QVERIFY2(result.contains(QLatin1String("exports: [\"Animal 1.0\"]")), qPrintable(result));
|
||||||
|
QVERIFY2(result.contains(QLatin1String("Enum {")), qPrintable(result));
|
||||||
|
}
|
||||||
|
|
||||||
void tst_qmlplugindump::plugin_data()
|
void tst_qmlplugindump::plugin_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QString>("import");
|
QTest::addColumn<QString>("import");
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
import QtQml 2.0
|
||||||
|
QtObject {
|
||||||
|
property string testTypeOf: typeof(contextProp)
|
||||||
|
}
|
|
@ -356,6 +356,7 @@ private slots:
|
||||||
void callPropertyOnUndefined();
|
void callPropertyOnUndefined();
|
||||||
void jumpStrictNotEqualUndefined();
|
void jumpStrictNotEqualUndefined();
|
||||||
void removeBindingsWithNoDependencies();
|
void removeBindingsWithNoDependencies();
|
||||||
|
void preserveBindingWithUnresolvedNames();
|
||||||
void temporaryDeadZone();
|
void temporaryDeadZone();
|
||||||
void importLexicalVariables_data();
|
void importLexicalVariables_data();
|
||||||
void importLexicalVariables();
|
void importLexicalVariables();
|
||||||
|
@ -8822,6 +8823,18 @@ void tst_qqmlecmascript::removeBindingsWithNoDependencies()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_qqmlecmascript::preserveBindingWithUnresolvedNames()
|
||||||
|
{
|
||||||
|
QQmlEngine engine;
|
||||||
|
QQmlComponent component(&engine, testFileUrl("preserveBindingWithUnresolvedNames.qml"));
|
||||||
|
QScopedPointer<QObject> object(component.create());
|
||||||
|
QVERIFY(!object.isNull());
|
||||||
|
QCOMPARE(object->property("testTypeOf").toString(), QString("undefined"));
|
||||||
|
QObject obj;
|
||||||
|
engine.rootContext()->setContextProperty("contextProp", &obj);
|
||||||
|
QCOMPARE(object->property("testTypeOf").toString(), QString("object"));
|
||||||
|
}
|
||||||
|
|
||||||
void tst_qqmlecmascript::temporaryDeadZone()
|
void tst_qqmlecmascript::temporaryDeadZone()
|
||||||
{
|
{
|
||||||
QJSEngine engine;
|
QJSEngine engine;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
import QtQuick 2.12
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
function createImplicitKeyNavigation() {
|
||||||
|
var item = Qt.createQmlObject("import QtQuick 2.0; Item { }", root);
|
||||||
|
item.KeyNavigation.up = root
|
||||||
|
item.destroy();
|
||||||
|
|
||||||
|
forceActiveFocus();
|
||||||
|
}
|
||||||
|
}
|
|
@ -86,6 +86,7 @@ private slots:
|
||||||
void keyNavigation_RightToLeft();
|
void keyNavigation_RightToLeft();
|
||||||
void keyNavigation_skipNotVisible();
|
void keyNavigation_skipNotVisible();
|
||||||
void keyNavigation_implicitSetting();
|
void keyNavigation_implicitSetting();
|
||||||
|
void keyNavigation_implicitDestroy();
|
||||||
void keyNavigation_focusReason();
|
void keyNavigation_focusReason();
|
||||||
void keyNavigation_loop();
|
void keyNavigation_loop();
|
||||||
void layoutMirroring();
|
void layoutMirroring();
|
||||||
|
@ -2164,6 +2165,29 @@ void tst_QQuickItem::keyNavigation_implicitSetting()
|
||||||
delete window;
|
delete window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QTBUG-75399
|
||||||
|
void tst_QQuickItem::keyNavigation_implicitDestroy()
|
||||||
|
{
|
||||||
|
QQuickView view;
|
||||||
|
view.setSource(testFileUrl("keynavigationtest_implicitDestroy.qml"));
|
||||||
|
view.show();
|
||||||
|
|
||||||
|
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||||
|
|
||||||
|
QQuickItem *root = view.rootObject();
|
||||||
|
QVERIFY(QMetaObject::invokeMethod(root, "createImplicitKeyNavigation"));
|
||||||
|
|
||||||
|
// process events is necessary to trigger upcoming memory access violation
|
||||||
|
QTest::qWait(0);
|
||||||
|
|
||||||
|
QVERIFY(root->hasActiveFocus());
|
||||||
|
|
||||||
|
QKeyEvent keyPress = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1);
|
||||||
|
QGuiApplication::sendEvent(&view, &keyPress); // <-- access violation happens here
|
||||||
|
// this should fail the test, even if the access violation does not occur
|
||||||
|
QVERIFY(!keyPress.isAccepted());
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QQuickItem::keyNavigation_focusReason()
|
void tst_QQuickItem::keyNavigation_focusReason()
|
||||||
{
|
{
|
||||||
QQuickView *window = new QQuickView(nullptr);
|
QQuickView *window = new QQuickView(nullptr);
|
||||||
|
|
|
@ -479,8 +479,12 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const QMetaObject *meta : qAsConst(objectsToMerge))
|
for (const QMetaObject *meta : qAsConst(objectsToMerge)) {
|
||||||
|
for (int index = meta->enumeratorOffset(); index < meta->enumeratorCount(); ++index)
|
||||||
|
dump(meta->enumerator(index));
|
||||||
|
|
||||||
writeMetaContent(meta, &knownAttributes);
|
writeMetaContent(meta, &knownAttributes);
|
||||||
|
}
|
||||||
|
|
||||||
qml->writeEndObject();
|
qml->writeEndObject();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue