1 2 /*************************************************************************** 3 qgsappdevtoolutils.h 4 ------------------------- 5 begin : March 2020 6 copyright : (C) 2020 by Nyall Dawson 7 email : nyall dot dawson at gmail dot com 8 *************************************************************************** 9 * * 10 * This program is free software; you can redistribute it and/or modify * 11 * it under the terms of the GNU General Public License as published by * 12 * the Free Software Foundation; either version 2 of the License, or * 13 * (at your option) any later version. * 14 * * 15 ***************************************************************************/ 16 #ifndef QGSAPPDEVTOOLUTILS_H 17 #define QGSAPPDEVTOOLUTILS_H 18 19 class QgsDevToolWidgetFactory; 20 #include <memory> 21 22 /** 23 * \ingroup app 24 * 25 * \brief Manages lifetime of a QgsDevToolWidgetFactory, automatically 26 * registering and unregistering it as required. 27 * 28 * \since QGIS 3.14 29 */ 30 class QgsScopedDevToolWidgetFactory 31 { 32 public: 33 QgsScopedDevToolWidgetFactory(); 34 ~QgsScopedDevToolWidgetFactory(); 35 36 void reset( std::unique_ptr< QgsDevToolWidgetFactory > factory = nullptr ); 37 38 private: 39 std::unique_ptr< QgsDevToolWidgetFactory > mFactory; 40 }; 41 42 43 #endif // QGSAPPDEVTOOLUTILS_H 44