Details
-
Bug
-
Resolution: Done
-
P2: Important
-
Qt for MCUs 1.5
-
None
-
-
1
-
UL Sprint 3.7
Description
If a state name contains a space the generated c++ source code is corrupted.
Following Qml code:
Rectangle {
width: 480
height: 272
states: [
State {
name: "Test 1"
}
]
}
will ceate following c++ code:
struct Test : Qul::Private::Items::Rectangle , public Qul::Private::Items::ItemBase ::ExtraStorage_itemExtraProperties<Qul::Private::Items::Rectangle > { Test(); void activateState_Test 1(Qul::Private::Items::Transition *, Qul::Private::Items::Transition::TransitionStatus); Qul::Property<Qul::Private::String> state; void activateDefaultState(Qul::Private::Items::Transition*, Qul::Private::Items::Transition::TransitionStatus); Qul::Private::State<Test> currentState; static Qul::Private::State<Test> stateFromName(Qul::Private::String name) { if (name == "") return &Test::activateDefaultState; if (name == Qul::Private::String(Qul::Private::Latin1String("Test 1", 6))) return &Test::activateState_Test 1; assert(!"Invalid state"); return &Test::activateDefaultState; } struct StateChangeEvent { Test *self; StateChangeEvent(Test *self) : self(self) {} void operator()(); }; Qul::Private::ChangedEvent<StateChangeEvent, Qul::Private::String > onStateChanged; };
This issue applies for all characters that are not c++ conform. These characters needs to be either replaced in the generated code or already forbidden in the QML Editor or the named needs to be marked as invalid name.