File indexing completed on 2024-05-19 05:55:48
0001 /* 0002 SPDX-FileCopyrightText: 2013 Valentin Rusu <kde@rusu.info> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef REGISTERCREATEACTIONMETHOD_H 0008 #define REGISTERCREATEACTIONMETHOD_H 0009 0010 #include <QList> 0011 #include <list> 0012 0013 class KActionCollection; 0014 0015 /** 0016 * This class is intended to avoid coupling between the main window and it's 0017 * contained widgets that handle actions. 0018 * 0019 * The main window it's a KXMLGuiWindow, that needs to have all the actions 0020 * created before the createGui method call. That would require for this class 0021 * to have knowledge for the actions of the child widgets, which is not very OO 0022 * wise. 0023 * 0024 * To avoid that, the main window will call createActions of this class that will 0025 * in turn delegate to the registered CreateActionsMethod's registered here. 0026 */ 0027 class RegisterCreateActionsMethod 0028 { 0029 public: 0030 using CreateActionsMethod = void (*)(KActionCollection *); 0031 0032 explicit RegisterCreateActionsMethod(CreateActionsMethod method); 0033 0034 static void createActions(KActionCollection *actionCollection); 0035 0036 }; 0037 0038 #endif // REGISTERCREATEACTIONMETHOD_H