Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

NEED HELP!!! Timer Method for Screen Saver in QML



  • Hi,

    There was an issue that the timer keeps looping in a screen saver.
    Below is my code.

    Timer {
    id: screenSaverTimer
    interval: 10000
    running: true
    repeat: true
    onTriggered: screenSaver.visible = true
    }

    onVisibleChanged: {
    if(visible)
    {
    screenSaver.visible = false;
    screenSaverTimer.restart();
    }
    }

    ImageScreenSaver{
    id: screenSaver
    z: 99
    Image {
    source: "assets/screensaver.png"

    MouseArea {
    anchors.fill: parent
    onClicked: {
    screenSaver.visible = false; screenSaverTimer.restart();}
    }
    }
    }

    The screen saver is ON after 10 seconds of inactivity as expected, however, it
    turned off itself without ANY activity/clicked after 20 seconds.
    I just can't find any reasons that it triggers to make it false every 20
    seconds.
    And this goes infinite loop...

    I would like to see screensaver stay true until its being clicked.
    Am I not following the correct timer method for this?

    I really need help with this....


  • Moderators

    @jpark said in NEED HELP!!! Timer Method for Screen Saver in QML:

    onVisibleChanged: {
    if(visible)
    {
    screenSaver.visible = false;

    Here is your loop which turns the screen saver off. That's my guess because I don't know what object is sending this signal, though.



  • @sierdzio Thanks for your feedback!
    Unfortunately, it still does the same thing..

    This is driving me crazy :(


Log in to reply