Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Pause Qt Symbian application when suspended in background
Qt 6.11 is out! See what's new in the release blog

Pause Qt Symbian application when suspended in background

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 2 Posters 2.1k 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.
  • T Offline
    T Offline
    tto04
    wrote on last edited by
    #1

    I am developing Qt application on symbian^3 device.
    I have timer loop where I render graphics to the screen.
    I have captured EEventFocusGained and EEventFocusLost events and I stop timer-loop when application has lost focus and start timer when focus is gained. I have done things like in this article:

    "http://www.developer.nokia.com/Community/Wiki/TSQ001585_-Detecting_focus_lost&gained_events_in_Qt_for_Symbian":http://www.developer.nokia.com/Community/Wiki/TSQ001585-Detecting_focus_lost&_gained_events_in_Qt_for_Symbian

    My application stops updating the screen when focus is lost.

    I have made part of user inteface with QML.

    I am trying to publish this application in ovi store but QA still fails saying that timer-loop does not stop when application is suspended in background.

    Is there some other events that I should capture or some other things' that I should take care?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kbcool
      wrote on last edited by
      #2

      Not very cross platform at all. I use this:

      @
      ApplicationActive::ApplicationActive(QObject *parent) :
      QObject(parent)
      {
      appActive = true;
      }

      bool ApplicationActive::isActive() {
      return appActive;
      }

      bool ApplicationActive::eventFilter(QObject *object, QEvent *event)
      {
      //qDebug() << event->type();
      if (event->type() == QEvent::ApplicationActivate || event->type() == QEvent::WindowActivate) {
      qDebug() << "Active";
      appActive = true;
      }

      if(event->type() == QEvent::ApplicationDeactivate || event->type() == QEvent::WindowDeactivate) {
           qDebug() << "Hidden";
          appActive = false;
      }
      
      emit isActiveWindowChanged();
      
      return false;
      

      }
      @

      then in main.cpp

      @
      ApplicationActive aa;
      viewer.installEventFilter(&aa);
      viewer.rootContext()->setContextProperty("application",&aa);
      @

      Then from your QML you can check if you should trigger your timer event with application.isActive()

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tto04
        wrote on last edited by
        #3

        Thanks' for that information.
        I will try with it.
        In few days we will see what the QA says.

        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