How to prevent closing the window
QML and Qt Quick
6
Posts
2
Posters
2.2k
Views
1
Watching
-
Hi,
How did you create the window ? Did you use Item as root component ?
-
You can use closing(QQuickCloseEvent*) signal and connect to a slot and reject the close event, but the problem here is that QQuickCloseEvent is not public and hence we cannot call its methods.
The only way I think would be to installEventFilter and look out for close event in *eventFilter(QObject *, QEvent ) and when you get it just ignore it.
-
Did you "installEventFilter":http://doc.qt.io/qt-5/qobject.html#installEventFilter ? You can do it in constructor
@
installEventFilter(this);
@