File indexing completed on 2024-05-12 05:12:48

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 class QWidget;
0010 class KConfigGroup;
0011 
0012 namespace AkonadiConsole
0013 {
0014 /**
0015  * @short Methods to save and restore the UI state of an application.
0016  *
0017  * This namespace provides methods that automatically save and restore
0018  * the state of various UI elements to/from a configuration group.
0019  *
0020  * The following widgets are supported so far:
0021  * - QSplitter
0022  * - QTabWidget
0023  * - QTreeView
0024  * - QComboBox
0025  *
0026  * @note The widgets need to have set an objectName, otherwise they are ignored
0027  *       on processing.
0028  *
0029  * @author Volker Krause <vkrause@kde.org>
0030  * @since 4.5
0031  */
0032 namespace UiStateSaver
0033 {
0034 /**
0035  * Saves the state of @p widget and all its sub-widgets to @p config.
0036  * @param widget The top-level widget which state should be saved.
0037  * @param config The config group the settings should be written to.
0038  */
0039 void saveState(QWidget *widget, KConfigGroup &config);
0040 
0041 /**
0042  * Restores the UI state of @p widget and all its sub-widgets from @p config.
0043  * @param widget The top-level widget which state should be restored.
0044  * @param config The config gorup the settings should be read from.
0045  */
0046 void restoreState(QWidget *widget, const KConfigGroup &config);
0047 }
0048 }