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 );
51 #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
58 QWindow *win = widget->windowHandle();
60 return QObject::eventFilter(
object, event );
62 if ( !( win->windowStates() & Qt::WindowMaximized ) )
64 QString key = mKeys[name];
68 QString key = mKeys[name];
72 widget->setProperty(
"widgetStateHelperWasShown", QVariant(
true ) );
74 return QObject::eventFilter(
object, event );
79 QString name = widgetSafeName( widget );
81 widget->installEventFilter(
this );
84 QString QgsWidgetStateHelper::widgetSafeName( QWidget *widget )
86 if ( widget->objectName().isEmpty() )
88 return widget->metaObject()->className();
90 return widget->objectName();