QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Public Member Functions | List of all members
QgsWidgetStateHelper Class Reference

QgsWidgetStateHelper is a helper class to save and restore the geometry of QWidgets in the application. More...

#include <qgswidgetstatehelper_p.h>

Inheritance diagram for QgsWidgetStateHelper:
Inheritance graph
[legend]

Public Member Functions

 QgsWidgetStateHelper (QObject *parent=nullptr)
 QgsWidgetStateHelper. More...
 
bool eventFilter (QObject *object, QEvent *event) override
 Event filter to catch events from registered widgets. More...
 
void registerWidget (QWidget *widget, const QString &key=QString())
 Register a widget to have it geometry state automatically saved and restored. More...
 

Detailed Description

QgsWidgetStateHelper is a helper class to save and restore the geometry of QWidgets in the application.

This removes the need for devs to remember to call saveGeometry() and restoreGeometry() when writing new widgets.

This helper is internal and should only be called via QgsGui::enabledAutoGeometryRestore

Since
QGIS 3.0

Definition at line 32 of file qgswidgetstatehelper_p.h.

Constructor & Destructor Documentation

◆ QgsWidgetStateHelper()

QgsWidgetStateHelper::QgsWidgetStateHelper ( QObject *  parent = nullptr)
explicit

QgsWidgetStateHelper.

Parameters
parentParent object

Definition at line 25 of file qgswidgetstatehelper_p.cpp.

Member Function Documentation

◆ eventFilter()

bool QgsWidgetStateHelper::eventFilter ( QObject *  object,
QEvent *  event 
)
override

Event filter to catch events from registered widgets.

Parameters
objectObject getting the event.
eventEvent sent from Qt.
Returns
Always returns true so that widget still gets event.

Definition at line 30 of file qgswidgetstatehelper_p.cpp.

◆ registerWidget()

void QgsWidgetStateHelper::registerWidget ( QWidget *  widget,
const QString &  key = QString() 
)

Register a widget to have it geometry state automatically saved and restored.

Parameters
widgetThe widget to save. Must have objectName() set.
keyThe override settings key name to use if objectName() isn't to be used. objectName() is the default if not set.

Definition at line 77 of file qgswidgetstatehelper_p.cpp.


The documentation for this class was generated from the following files: