示例#1
0
void AutoSaver::timerEvent(QTimerEvent *event)
{
    if (event->timerId() == m_timer.timerId()) {
        saveIfNeccessary();
    } else {
        QObject::timerEvent(event);
    }
}
示例#2
0
void AutoSaver::changeOccurred()
{
    if (m_firstChange.isNull())
        m_firstChange.start();

    if (m_firstChange.elapsed() > MAXWAIT) {
        saveIfNeccessary();
    } else {
        m_timer.start(AUTOSAVE_IN, this);
    }
}
void AutoSaver::changeOccurred()
{
    if (first_change_.isNull())
    {
        first_change_.start();
    }

    if (first_change_.elapsed() > MAXWAIT)
    {
        saveIfNeccessary();
    }
    else
    {
        timer_.start(AUTOSAVE_IN, this);
    }
}