Solved Problem with using components between files
-
When I'm trying to use code from file Animation.qml in other file, I get an error, I use it in other file like this
Also I'm wondering if there is better way to use components from other files, cause sometimes I want one or few things, not whole code and by using it like with this Animation.qml file, I always add visible: false, so it doesnt show up
Animation.qml
import QtQuick 2.2 Item { property bool accelerating: false property int gear: 1 function gears(gear){ if(gear === 1){ return 80 } if (gear === 2){ return 55 } if (gear === 3){ return 38 } if (gear === 4){ return 27 } if (gear === 5){ return 22 } if (gear === 6){ return 15 } } Keys.onSpacePressed: accelerating = true Keys.onReleased: { if (event.key === Qt.Key_Space) { accelerating = false; event.accepted = true; } } Keys.onUpPressed:{ if(gear === 6){ }else{ gear++ //console.log("Gear: " + gear.toString()) } } Keys.onDownPressed:{ if (gear === 1){ }else{ gear-- //console.log("Gear: " + gear.toString()) } } }
-
There is already a component called Animation so your component is crashing, try changing the name of your component.
-
There is already a component called Animation so your component is crashing, try changing the name of your component.