File indexing completed on 2022-11-29 13:02:28

0001 /*
0002     SPDX-FileCopyrightText: 2014-2016 Ivan Cukic <ivan.cukic(at)kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef ACTIVITIES_MAINTHREADEXECUTOR_P
0008 #define ACTIVITIES_MAINTHREADEXECUTOR_P
0009 
0010 #include <functional>
0011 
0012 #include <QObject>
0013 
0014 namespace KActivities
0015 {
0016 namespace detail
0017 {
0018 class MainThreadExecutor : public QObject
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     MainThreadExecutor(std::function<void()> &&f);
0024 
0025     Q_INVOKABLE void start();
0026 
0027 private:
0028     std::function<void()> m_function;
0029 };
0030 } // namespace detail
0031 
0032 void runInMainThread(std::function<void()> &&f);
0033 
0034 } // namespace KActivities
0035 
0036 #endif // ACTIVITIES_MAINTHREADEXECUTOR_P