Solved Error while running qt code in imx6 version 5.9.2
-
I am using imx6 with version 5.9.2
When i am ruuning qt code its giving error as:- Unexpected token `reserved word'
- qrc:/..... Expected token `:'
What is this error about? Also i am using enum in my code, is this the reason?
If yes then how this error can be eliminatied?My enum structure look like this :
enum TEST_TYPE
{
TEST_ONGOING,
TEST_FAIL,
TEST_CONDITIONAL_OUTCOME,
TEST_PASS
} -
Is this a runtime error or compilation error? Does the app work when launched on a desktop?
From the error messages I guess that you have something wrong in your QRC file or call. But you have to provide more code for me to check that.
-
@sierdzio
Its a run time error. Yes its working fine in Desktop.Complete code:
import QtQuick 2.0
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.5Item
{
id: mainStatusIndicatorQtObject { id: properties property int btnWidth: mainStatusIndicator.width property int btnHeight: mainStatusIndicator.height property string statusindicatorColor property string blueColor: "blue" property string redColor: "red" property string yellowColor: "yellow" property string greenColor: "green" property string grayColor: "#7B7D7D" property string blackColor: "black" } enum TEST_TYPE { TEST_ONGOING, TEST_FAIL, TEST_CONDITIONAL_OUTCOME, TEST_PASS } function setTestType(type) { properties.statusindicatorColor = type if(type === StatusIndicatorWidget.TEST_TYPE.TEST_ONGOING) { properties.statusindicatorColor = properties.blueColor } else if(type === StatusIndicatorWidget.TEST_TYPE.TEST_FAIL) { properties.statusindicatorColor = properties.redColor } else if(type === StatusIndicatorWidget.TEST_TYPE.TEST_CONDITIONAL_OUTCOME) { properties.statusindicatorColor = properties.yellowColor } else if(type === StatusIndicatorWidget.TEST_TYPE.TEST_PASS) { properties.statusindicatorColor = properties.greenColor } } Rectangle { id: firstCircle width: height height: Math.min(parent.width,parent.height) radius: width/2 color: properties.grayColor Rectangle { id: secondCircle width: firstCircle.width * 0.80 height: firstCircle.height * 0.80 radius: width/2 color: properties.blackColor anchors.centerIn: parent Rectangle { id: thirdCircle width: secondCircle.width * 0.70 height: secondCircle.height * 0.70 radius: width/2 color: properties.statusindicatorColor anchors.centerIn: parent } } }
}
-
The ability to declare enumerations in QML was introduced in Qt 5.10.
You need to bump your import to
import QtQuick 2.10
at least. And yes, that means this code will not work on Qt 5.9.2 which you are using on your embedded board.