Advertisement
Guest User

QTimer in Cascades

a guest
Jan 12th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import bb.cascades 1.0
  2. import my.lib 1.0
  3. Page {
  4.    
  5.     content: Container{
  6.            Label {
  7.                 id: timer_status;
  8.            }
  9.     }
  10.    
  11.     attachedObjects: [
  12.       QTimer{
  13.             id:my_timer
  14.             interval: 3000
  15.             //active: false
  16.             onTimeout: {
  17.                 timer_status.text = "Timer stopped"
  18.                 stop();
  19.             }
  20.         }    
  21.     ]
  22.  
  23.     onCreationCompleted: {
  24.         Application.fullscreen.connect(onFullscreen);
  25.     }
  26.      
  27.     function onFullscreen() {
  28.         my_timer.start()
  29.         timer_status.text = "Timer started"
  30.     }
  31.    
  32.     actions: [
  33.        
  34.         ActionItem {
  35.             title: "Start timer";
  36.             ActionBar.placement: ActionBarPlacement.OnBar;
  37.             onTriggered: {
  38.                 timer_status.text = "Timer started"
  39.                 my_timer.start();  
  40.             }
  41.         }
  42.        
  43.     ]
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement