Add a column to the default method error message
This brings both compilers in sync by reporting line and column if doing a signal object assignment without a default method. Change-Id: I8b1bf90c4ce3cd7b117ad7eecdbfe319b07b1191 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
parent
b4e67a087e
commit
16e70231d7
|
@ -1343,6 +1343,7 @@ void QQmlCompiler::genObjectBody(QQmlScript::Object *obj)
|
|||
|
||||
Instruction::AssignSignalObject assign;
|
||||
assign.line = v->location.start.line;
|
||||
assign.column = v->location.start.column;
|
||||
assign.signal = output->indexForString(prop->name().toString());
|
||||
output->addInstruction(assign);
|
||||
|
||||
|
|
|
@ -403,6 +403,7 @@ union QQmlInstruction
|
|||
QML_INSTR_HEADER
|
||||
int signal;
|
||||
ushort line;
|
||||
ushort column;
|
||||
};
|
||||
struct instr_createComponent {
|
||||
QML_INSTR_HEADER
|
||||
|
|
|
@ -775,7 +775,7 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
|
|||
|
||||
QMetaMethod method = QQmlMetaType::defaultMethod(assign);
|
||||
if (!method.isValid())
|
||||
VME_EXCEPTION(tr("Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())), instr.line);
|
||||
VME_EXCEPTION_WITH_COLUMN(tr("Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())), instr.line, instr.column);
|
||||
|
||||
if (!QMetaObject::checkConnectArgs(prop.method(), method)) {
|
||||
VME_EXCEPTION(tr("Cannot connect mismatched signal/slot %1 %vs. %2")
|
||||
|
|
|
@ -620,7 +620,7 @@ void tst_qqmlqt::createQmlObject()
|
|||
QString warning3 = component.url().toString()+ ":11: Error: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("main.qml").toString() + ":4:14: Duplicate property name";
|
||||
QString warning4 = component.url().toString()+ ":9: Error: Qt.createQmlObject(): Missing parent object";
|
||||
QString warning5 = component.url().toString()+ ":8: Error: Qt.createQmlObject(): Invalid arguments";
|
||||
QString warning6 = "RunTimeError: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("inline").toString() + ":3: Cannot assign object type QObject with no default method";
|
||||
QString warning6 = "RunTimeError: Qt.createQmlObject(): failed to create object: \n " + testFileUrl("inline").toString() + ":3:16: Cannot assign object type QObject with no default method";
|
||||
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
|
||||
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
|
||||
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
|
||||
|
|
|
@ -831,7 +831,7 @@ void tst_QQuickLoader::nonItem()
|
|||
void tst_QQuickLoader::vmeErrors()
|
||||
{
|
||||
QQmlComponent component(&engine, testFileUrl("vmeErrors.qml"));
|
||||
QString err = testFileUrl("VmeError.qml").toString() + ":6: Cannot assign object type QObject with no default method";
|
||||
QString err = testFileUrl("VmeError.qml").toString() + ":6:26: Cannot assign object type QObject with no default method";
|
||||
QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData());
|
||||
QQuickLoader *loader = qobject_cast<QQuickLoader*>(component.create());
|
||||
QVERIFY(loader);
|
||||
|
|
Loading…
Reference in New Issue