17#include "moc_qgswidgetstatehelper_p.cpp"
33 if ( event->type() == QEvent::Close ||
34 event->type() == QEvent::Destroy ||
35 event->type() == QEvent::Hide )
37 QWidget *widget = qobject_cast<QWidget *>(
object );
40 if ( widget->property(
"widgetStateHelperWasShown" ).toBool() )
42 const QString name = widgetSafeName( widget );
43 const QString key = mKeys[name];
47 else if ( event->type() == QEvent::Show )
49 QWidget *widget = qobject_cast<QWidget *>(
object );
50 const QString name = widgetSafeName( widget );
58 QWindow *win = widget->windowHandle();
60 return QObject::eventFilter(
object, event );
62 if ( !( win->windowStates() & Qt::WindowMaximized ) )
64 const QString key = mKeys[name];
68 widget->setProperty(
"widgetStateHelperWasShown", QVariant(
true ) );
70 return QObject::eventFilter(
object, event );
75 const QString name = widgetSafeName( widget );
77 widget->installEventFilter(
this );
80QString QgsWidgetStateHelper::widgetSafeName( QWidget *widget )
82 if ( widget->objectName().isEmpty() )
84 return widget->metaObject()->className();
86 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.