31 if ( event->type() == QEvent::Close ||
event->type() == QEvent::Destroy )
33 QWidget *widget = qobject_cast<QWidget *>( object );
36 if ( widget->property(
"widgetStateHelperWasShown" ).toBool() )
38 QString name = widgetSafeName( widget );
39 QString key = mKeys[name];
43 else if ( event->type() == QEvent::Show )
45 QWidget *widget = qobject_cast<QWidget *>( object );
46 QString name = widgetSafeName( widget );
47 QString key = mKeys[name];
49 widget->setProperty(
"widgetStateHelperWasShown", QVariant(
true ) );
51 return QObject::eventFilter(
object, event );
56 QString name = widgetSafeName( widget );
58 widget->installEventFilter(
this );
61 QString QgsWidgetStateHelper::widgetSafeName( QWidget *widget )
63 if ( widget->objectName().isEmpty() )
65 return widget->metaObject()->className();
67 return widget->objectName();
void saveGeometry(QWidget *widget, const QString &keyName)
Save the wigget geometry into settings.
bool restoreGeometry(QWidget *widget, const QString &keyName)
Restore the wigget geometry from settings.