File indexing completed on 2024-05-19 13:31:07
0001 /*************************************************************************** 0002 * Copyright (C) 2016 Christian Ehrlicher <ch.ehrlicher@gmx.de> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the * 0016 * Free Software Foundation, Inc., * 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 0018 ***************************************************************************/ 0019 0020 #pragma once 0021 0022 #include <QPointer> 0023 #include <QString> 0024 0025 class KConfig; 0026 class QWidget; 0027 0028 /** 0029 * @brief A small helper class to restore/save the dialog dimensions 0030 */ 0031 class WindowGeometryHelper 0032 { 0033 public: 0034 WindowGeometryHelper(QWidget *w, const QString &groupName); 0035 ~WindowGeometryHelper() = default; 0036 0037 static void restore(QWidget *w, const QString &groupName); 0038 static void save(QWidget *w, const QString &groupName); 0039 0040 // no need to call restore() - already called in ctor when bAutoRestore = true 0041 void restore(); 0042 void save(); 0043 0044 private: 0045 QPointer<QWidget> m_widget; 0046 const KConfig *m_config; 0047 QString m_groupName; 0048 };