Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. NEED HELP!!! Timer Method for Screen Saver in QML
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 580 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jpark
    wrote on last edited by
    #1

    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....

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @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.

      (Z(:^

      J 1 Reply Last reply
      1
      • sierdzioS sierdzio

        @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.

        J Offline
        J Offline
        jpark
        wrote on last edited by
        #3

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

        This is driving me crazy :(

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved