summaryrefslogtreecommitdiffstats
path: root/utils/signalwaiter.h
blob: a4130727748e8bfbb955ff307d86ae7070031d2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef SCRIPTING_INTERNAL_SIGNALWAITER_H
#define SCRIPTING_INTERNAL_SIGNALWAITER_H

#include <QObject>

namespace Scripting {
namespace Internal {

/**
 * @brief Wait for a signal to emit
 *
 * The method wait will block until the provided signal is emitted or the time out is reached. While blocking it will run the event loop.
 */
class SignalWaiter : public QObject
{
    Q_OBJECT
public:
    explicit SignalWaiter(QObject *parent = 0);
    bool wait(QObject* object, const char* signal, int msecs);

private slots:
    void slotReceived();

private:
    bool m_received;
};

} // namespace Internal
} // namespace Scripting

#endif // SCRIPTING_INTERNAL_SIGNALWAITER_H