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. How to detect any user interaction on monitor
Forum Updated to NodeBB v4.3 + New Features

How to detect any user interaction on monitor

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 2 Posters 1.4k Views 1 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.
  • tanmanh0707T Offline
    tanmanh0707T Offline
    tanmanh0707
    wrote on last edited by
    #1

    Hi all,

    I have problem in detecting any user interaction on monitor. I need to know if user interacts with monitor or not for a specified period.

    For example, If there isn't any interactions for 5 minutes, set the brightness to lowest value for power saving. The interactions may be clicking on buttons, flicking... or even touching anywhere on the monitor (I mean that touching a non-object on monitor).

    Can I do it on QML layer? (I have many screens)
    I prefer doing it on C++ layer.

    Thank you.

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

      I understand you have a full-screen application? Then you can put a MouseArea on the main view, stretch it so that it covers the whole app window, and detect clicks there. You just need to remember not to block events for underlying UI, so set event.accepted = false in your slots.

      (Z(:^

      tanmanh0707T 1 Reply Last reply
      2
      • sierdzioS sierdzio

        I understand you have a full-screen application? Then you can put a MouseArea on the main view, stretch it so that it covers the whole app window, and detect clicks there. You just need to remember not to block events for underlying UI, so set event.accepted = false in your slots.

        tanmanh0707T Offline
        tanmanh0707T Offline
        tanmanh0707
        wrote on last edited by
        #3

        @sierdzio Thank you for your suggestion.

        Yes, I have a full-screen application.
        But I think it is not a good way. I actually have 1 main view, but have a lot of screens which are loaded by Loader. Each screen contains several items (buttons, listview, etc). By your way, I have to catch even from every buttons, listview,... right? It will be a big thing to do.

        sierdzioS 1 Reply Last reply
        0
        • tanmanh0707T tanmanh0707

          @sierdzio Thank you for your suggestion.

          Yes, I have a full-screen application.
          But I think it is not a good way. I actually have 1 main view, but have a lot of screens which are loaded by Loader. Each screen contains several items (buttons, listview, etc). By your way, I have to catch even from every buttons, listview,... right? It will be a big thing to do.

          sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          @tanmanh0707 said in How to detect any user interaction on monitor:

          By your way, I have to catch even from every buttons, listview,... right? It will be a big thing to do.

          No, the contrary in fact. I suggest making one, single, top-level MouseArea. Put your user interaction checking code there (in any slot you need to support), then allow all mouse events to pass through that MouseArea by setting accepted to false. This way all events will be passed down to other QML elements you have. You only need to modify that top-level MouseArea, the rest of your application stays the same.

          (Z(:^

          1 Reply Last reply
          3

          • Login

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