File indexing completed on 2024-05-19 05:14:38

0001 /*
0002     SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kaddressbook_export.h"
0010 
0011 class QWidget;
0012 class KConfigGroup;
0013 
0014 namespace KAddressBook
0015 {
0016 /**
0017  * @short Methods to save and restore the UI state of an application.
0018  *
0019  * This namespace provides methods that automatically save and restore
0020  * the state of various UI elements to/from a configuration group.
0021  *
0022  * The following widgets are supported so far:
0023  * - QSplitter
0024  * - QTabWidget
0025  * - QTreeView
0026  * - QComboBox
0027  *
0028  * @note The widgets need to have set an objectName, otherwise they are ignored
0029  *       on processing.
0030  *
0031  * @author Volker Krause <vkrause@kde.org>
0032  * @since 4.5
0033  */
0034 namespace UiStateSaver
0035 {
0036 /**
0037  * Saves the state of @p widget and all its sub-widgets to @p config.
0038  * @param widget The top-level widget which state should be saved.
0039  * @param config The config group the settings should be written to.
0040  */
0041 KADDRESSBOOK_EXPORT void saveState(QWidget *widget, KConfigGroup &config);
0042 
0043 /**
0044  * Restores the UI state of @p widget and all its sub-widgets from @p config.
0045  * @param widget The top-level widget which state should be restored.
0046  * @param config The config gorup the settings should be read from.
0047  */
0048 KADDRESSBOOK_EXPORT void restoreState(QWidget *widget, const KConfigGroup &config);
0049 }
0050 }