Unsolved Extra characters after test expression
-
qmlscene a.qml
a.qml:1: Extra characters after test expression.
Error processing project file: a.qmlimport QtQuick 2.3 Rectangle { width: 300 height: 300 color: "lightgray" Text { anchors.centerIn: parent text: "Hello, QML!" } }
-
I've tried the code you pasted with
qmlscene
from Qt 5.15 and it worked without any errors or warnings.Make sure your file is encoded with UTF-8. Try changing line ending style to Unix if that does not help.
-
@sonichy said in Extra characters after test expression:
Error processing project file: a.qml
is that copied and pasted? because qml file that instantiate items have to start with a capital letter!
-
@J-Hilk said in Extra characters after test expression:
@sonichy said in Extra characters after test expression:
Error processing project file: a.qml
is that copied and pasted? because qml file that instantiate items have to start with a capital letter!
Not if it's the only file opened by
qmlscene
(same asmain.qml
does not need to beMain.qml
in regular apps). -
@sierdzio thats why I wrote instantiate items, may be the wrong wording 🤷♂️
if you have somewhere ein your code
MyQmlObject { }
the class has to have a capital starting letter, If you load stuff directly to the qml engine, than yes, no capital letter needed