I have a program that hides in a system tray area. It uses few dialogs for interactions with user. The problem is when i hide my app to tray with some dialogs still open. After restoring the windows to normal stated, dialogs disappear. The problem occurs on Ubuntu 17.10 with Qt 5.9.2, but I suppose that other Linux distributions may have this problem as well. I tested it with Plasma, GNOME and Unity. Same result. Windows version of my program works correctly, windows are hidden and restored as expected. Simple code can present the issue:
#include <QtWidgets>
#include <QtGui>
int main(int argc, char *argv[]) {
QTimer::singleShot(1000,
[&] { w.
show();
});
QTimer::singleShot(2000,
[&] { d.
show();
});
QTimer::singleShot(3000,
[&] { w.
showMinimized();
});
QTimer::singleShot(4000,
[&] { w.
hide();
});
QTimer::singleShot(5000,
[&] { w.
show();
});
QTimer::singleShot(6000,
[&] { w.
showNormal();
});
a.exec();
}
#include <QtWidgets>
#include <QtGui>
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QWidget w;
QDialog d(&w);
QTimer::singleShot(1000, [&] { w.show(); });
QTimer::singleShot(2000, [&] { d.show(); });
QTimer::singleShot(3000, [&] { w.showMinimized(); });
QTimer::singleShot(4000, [&] { w.hide(); });
QTimer::singleShot(5000, [&] { w.show(); });
QTimer::singleShot(6000, [&] { w.showNormal(); });
a.exec();
}
To copy to clipboard, switch view to plain text mode
After w.hide() dialog won't show again. Any additional calls of dialog methods like show(), showNormal() do nothing. Any ideas? Is this a bug, or is there something wrong with my code?
Bookmarks