Advertisement
Guest User

QML Connections signal notifications

a guest
May 4th, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Main.qml
  2.  
  3. PageStackWindow {
  4.     id: rootWindow
  5.  
  6.     property int checkVar: 0
  7.  
  8.     function fn1() {
  9.         checkVar = 2;
  10.     checkVar = 1;
  11.     checkVar = 0;
  12.     }
  13.  
  14.     CustomComp {
  15.        id: c1
  16.     }
  17.  
  18.     onCheckVarChanged: {
  19.         console.log("cvar changed in root window "+checkVar); // here it prints only 3 times                 
  20.                                   // which is correct  
  21.     }
  22. }
  23.  
  24. CustomComp.qml
  25.  
  26. Item{
  27.     Connections{
  28.         target: rootWindow
  29.         onCheckVarChanged:{
  30.         console.log("cvar changed in root window printed in custom component : "+checkVar);
  31.             // here it prints twice for each change ie., 6 times.. why?
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement