File indexing completed on 2024-04-28 04:44:14
0001 #ifndef LAMBDAHINT_H 0002 #define LAMBDAHINT_H 0003 0004 #include "snore_exports.h" 0005 /* 0006 SnoreNotify is a Notification Framework based on Qt 0007 Copyright (C) 2015 Hannah von Reth <vonreth@kde.org> 0008 0009 SnoreNotify is free software: you can redistribute it and/or modify 0010 it under the terms of the GNU Lesser General Public License as published by 0011 the Free Software Foundation, either version 3 of the License, or 0012 (at your option) any later version. 0013 0014 SnoreNotify is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 GNU Lesser General Public License for more details. 0018 0019 You should have received a copy of the GNU Lesser General Public License 0020 along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>. 0021 */ 0022 #include <QVariant> 0023 0024 #include <functional> 0025 0026 namespace Snore 0027 { 0028 0029 /** 0030 * LambdaHint is a helper type to enable us to inset functions into the hints. 0031 * This is useful to be able to add hints that might change during runtime. 0032 * 0033 * @author Hannah von Reth \<vonreth at kde.org\> 0034 */ 0035 0036 class SNORE_EXPORT LambdaHint 0037 { 0038 public: 0039 LambdaHint(); 0040 LambdaHint(std::function< QVariant() > function); 0041 0042 QVariant operator()(); 0043 0044 private: 0045 std::function<QVariant() > m_func; 0046 }; 0047 0048 } 0049 0050 Q_DECLARE_METATYPE(Snore::LambdaHint) 0051 0052 #endif // LAMBDAHINT_H