Guest User

Untitled

a guest
Feb 24th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. var component;
  2. var gauge;
  3.  
  4. function createVerticalGauge(setWidth,setX,setY,setID,setText,setValue) {
  5. component = Qt.createComponent("verticalbargauge.qml");
  6. console.log(component.status)
  7. if (component.status == Component.Ready)
  8. finishCreation(setWidth,setX,setY,setID,setText,setValue);
  9. else
  10. component.statusChanged.connect(finishCreation);
  11. }
  12.  
  13. function finishCreation(setWidth,setX,setY,setID,setText,setValue) {
  14. if (component.status == Component.Ready) {
  15. gauge = component.createObject(adaptronicDash, {"id": setID, "gaugetext": setValue,
  16. "x": setX, "y": setY});
  17. gauge.width = setWidth;
  18. if (gauge == null) {
  19. // Error Handling
  20. console.log("Error creating object");
  21. }
  22. } else if (component.status == Component.Error) {
  23. // Error Handling
  24. console.log("Error loading component:", component.errorString());
  25. }
  26. }
  27.  
  28. Component.onCompleted: CreateVerticalGaugeScript.createVerticalGauge(300,10,300,"map","MAP",Dashboard.MAP);
Add Comment
Please, Sign In to add comment