Reply
Thread Tools
sakya's Avatar
Posts: 533 | Thanked: 1,341 times | Joined on Dec 2010 @ Italy
#1
Hi,

I noticed a strange behaviour of an application I'm developing.
It seems that tapping the power button locks the screen update of my app for a pair of seconds.

During this time the app gets user inputs (like click a button) but the screen is not updated.

I made a little test application.
It just contains a label updated by a timer with the current time and a button.

Code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QTimer>
#include <QDateTime>
#ifdef Q_WS_MAEMO_5
    #include <QtGui/QX11Info>
    #include <X11/Xlib.h>
    #include <X11/Xatom.h>
    #include <X11/Xutil.h>
#endif

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    m_Pressed = 0;

    connect(&m_Timer, SIGNAL(timeout()), this, SLOT(onTimer()));
    m_Timer.setInterval(500);
    m_Timer.setSingleShot(false);
    m_Timer.start();
    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
    connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(close()));

    onTimer();
    onButtonClicked();
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::onTimer()
{
    ui->lblTime->setText(QDateTime::currentDateTime().toString("hh:mm:ss"));
}

void MainWindow::onButtonClicked()
{
    ui->lblOutput->setText(QString("Pressed %1 times").arg(m_Pressed));
    m_Pressed++;
}
If you disable the power button menu (it would hide the app) with the command:
Code:
pkill -STOP systemui
and then launch qtpowerbuttontest you can see this problem: tap the power button and the time label isn't updated for 2 seconds.
While the app seems locked press the button, when the screen is updated you'll see that the button was pressed...

Can someone help me solve this problem? What is the N900 doing when I tap the power button?

To reenable the power button:
Code:
pkill -CONT systemui
Attached Files
File Type: zip qtPowerButtonTest.zip (2.5 KB, 77 views)
 
Reply


 
Forum Jump


All times are GMT. The time now is 02:31.