Take the QtOrNot quiz,
and see if you can tell
Qt code from Symbian C++
Task: Asynchronous callback
class CMyTimer : public CActive
{
public:
    ~CMyTimer();
    static CMyTimer* NewLC();
    void StartL(TTimeIntervalMicroSeconds32
             aDelay);

private:
    CMyTimer();
    void ConstructL();
    void RunL();
    void DoCancel();

    RTimer iTimer;
};

CMyTimer::CMyTimer() :
    CActive(EPriorityStandard) { }

CMyTimer* CMyTimer::NewLC()
{
    CMyTimer* self = new (ELeave) CMyTimer();
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
}

void CMyTimer::ConstructL()
{
    User::LeaveIfError(iTimer.CreateLocal());
    CActiveScheduler::Add(this);
}

CMyTimer::~CMyTimer()
{
    Cancel();
    iTimer.Close();
}

void CMyTimer::DoCancel()
{
    iTimer.Cancel();
}

void CMyTimer::StartL(
        TTimeIntervalMicroSeconds32 aDelay)
{
    DP("Starting timer.");
    Cancel();
    iTimer.After(iStatus, aDelay);
    SetActive();
}

void CMyTimer::RunL()
{
    DP("Timer expired.");
}