41 lines
1.5 KiB
C++
41 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <QRect>
|
|
#include <QString>
|
|
|
|
class QWidget;
|
|
|
|
namespace Cevo {
|
|
|
|
// Equivalent of PersistentForm.pas's TPersistentForm: window geometry
|
|
// persistence across sessions. Re-architected around Qt's native
|
|
// QWidget::save/restoreGeometry() + QSettings instead of the original's
|
|
// Windows-Registry-based TRect/WindowState bookkeeping - restoreGeometry()
|
|
// already clamps off-screen geometry to the current screen layout, which
|
|
// covers what CheckEntireVisible/CheckPartVisible did by hand. The
|
|
// original's recursive per-control persistence (TListView column widths,
|
|
// TPanel docked size) is NOT ported: LCL-specific widget introspection with
|
|
// no current consumer. Add a narrower, Qt-idiomatic equivalent (e.g.
|
|
// persisting a specific QTreeWidget's column widths) once a concrete form
|
|
// actually needs it.
|
|
class PersistentForm {
|
|
public:
|
|
// settingsGroup: QSettings group this form's state is stored under
|
|
// (e.g. "Forms/MainWindow") - assumes the application has already set
|
|
// QCoreApplication::setOrganizationName()/setApplicationName().
|
|
explicit PersistentForm(QString settingsGroup);
|
|
|
|
void load(QWidget *form, bool defaultMaximized = false, bool defaultFullScreen = false);
|
|
void save(QWidget *form) const;
|
|
|
|
bool isFullScreen() const { return m_fullScreen; }
|
|
void setFullScreen(QWidget *form, bool state);
|
|
|
|
private:
|
|
QString m_settingsGroup;
|
|
QRect m_restoredGeometry;
|
|
bool m_fullScreen = false;
|
|
};
|
|
|
|
} // namespace Cevo
|