File indexing completed on 2024-11-24 03:41:05
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2003 George Staikos <staikos@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef _KTIMEOUT_H_ 0009 #define _KTIMEOUT_H_ 0010 0011 #include <QHash> 0012 #include <QObject> 0013 0014 // @internal 0015 class KTimeout : public QObject 0016 { 0017 Q_OBJECT 0018 public: 0019 explicit KTimeout(QObject *parent = nullptr); 0020 ~KTimeout() override; 0021 0022 Q_SIGNALS: 0023 void timedOut(int id); 0024 0025 public Q_SLOTS: 0026 void resetTimer(int id, int timeout); 0027 void addTimer(int id, int timeout); 0028 void removeTimer(int id); 0029 void clear(); 0030 0031 protected: 0032 void timerEvent(QTimerEvent *) override; 0033 0034 private: 0035 QHash<int /*id*/, int /*timerId*/> _timers; 0036 }; 0037 0038 #endif