32 if ( event->type() == QEvent::Close ||
33 event->type() == QEvent::Destroy ||
34 event->type() == QEvent::Hide )
36 QWidget *widget = qobject_cast<QWidget *>(
object );
39 if ( widget->property(
"widgetStateHelperWasShown" ).toBool() )
41 QString name = widgetSafeName( widget );
42 QString key = mKeys[name];
46 else if ( event->type() == QEvent::Show )
48 QWidget *widget = qobject_cast<QWidget *>(
object );
49 QString name = widgetSafeName( widget );
57 QWindow *win = widget->windowHandle();
59 return QObject::eventFilter(
object, event );
61 if ( !( win->windowStates() & Qt::WindowMaximized ) )
63 QString key = mKeys[name];
67 widget->setProperty(
"widgetStateHelperWasShown", QVariant(
true ) );
69 return QObject::eventFilter(
object, event );
74 QString name = widgetSafeName( widget );
76 widget->installEventFilter(
this );
79 QString QgsWidgetStateHelper::widgetSafeName( QWidget *widget )
81 if ( widget->objectName().isEmpty() )
83 return widget->metaObject()->className();
85 return widget->objectName();
bool restoreGeometry(QWidget *widget, const QString &keyName)
Restore the wigget geometry from settings.
void saveGeometry(QWidget *widget, const QString &keyName)
Save the wigget geometry into settings.