I'm trying to find a signal to know when a qwidget is visible or not, I mean, when a QWidget is at the top of the desktop or when it's hide under some window.
I also would like to know with a signal when a QWidget window is minimized and when it's restored (un-minimized). I have tried the next code, but when I minimize my window, the window closes and is not in the applications bar.
void KGLWidget::changeEvent(QEvent *event) {
if (event->type() == QEvent::WindowStateChange) {
if (isMinimized() || !isVisible()) {
emit onHide();
event->ignore();
qDebug() << "NO SE VE";
return;
}
if(isVisible()) {
emit onShow();
event->ignore();
qDebug() << "SI SE VE";
return;
}
}
QWidget::changeEvent(event);
}
I also tried with event->accept(), also without event->ignore() and without return; but the qwidget window always closes.
Thank you very much, I really appreciate your time and your help.
Thanks in advance.