qt - lock screen-qml -


from past 1 week trying solve issue. not able lock screen of whatever pages create. tried putting timer. not getting how should detect if user not active. example ex1.qml

rectangle{ id:ex1 color:"red" keys.onreturnpressed:{ ex2.visble=true; visible=false; } rectangle { id:ex2 color:"blue" keys.onreturnpressed:{ visible=false; ex1.visible=true; } } } 

if user not active time application should ask password unlock it. if user not pressing enter key 2 mins should lock screen , ask password. how it???

i waiting answer. in advance.

you can try this:

focusscope{     height: 500;     width:500;     focus: true;     rectangle {         id:ex1         color:"red"         focus: ex1.visible;         visible:true;         anchors.fill: parent;         keys.onenterpressed: {             locktimer.restart();         }         keys.onreturnpressed:{             locktimer.restart();         }     }     rectangle {         id:ex2         color:"blue";         focus: !ex1.visible;         visible: !ex1.visible;         anchors.fill: parent;         keys.onreturnpressed:{             password.opacity=1;         }         text {             id: password;             anchors.centerin: parent             opacity: 0;             text: "enter password"         }     }  timer{     id:locktimer;     repeat: false;     ontriggered: {         ex2.visible=true;         ex1.visible=false;     } }  function settimer(val){     locktimer.interval=60000*val; }  component.oncompleted: {     settimer(2);     locktimer.start(); } 

}


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -