Hi,
I need help, I want to minimize program to tray, and everything is ok but when program is minimized and messagebox (or any dialog/popup) shows program is quiting with Exited normally (?!) Tested on qt 4.7 and 4.8.
So how and what I need to change in this code ? Or maybe there is better solution for minimizing program ? (I need example of course)
void MainWindow
::changeEvent(QEvent *event
) {
if (event
->type
() == QEvent::WindowStateChange) {
if ((e->oldState() != Qt::WindowMinimized) && isMinimized())
{
if (Core::instance()->settings["minimize_to_tray"] == "on")
{
QTimer::singleShot(0,
this,
SLOT(hide
()));
event->ignore();
}
}
}
}
void MainWindow::changeEvent(QEvent *event)
{
QMainWindow::changeEvent(event);
if (event->type() == QEvent::WindowStateChange)
{
QWindowStateChangeEvent *e = (QWindowStateChangeEvent*)event;
if ((e->oldState() != Qt::WindowMinimized) && isMinimized())
{
if (Core::instance()->settings["minimize_to_tray"] == "on")
{
QTimer::singleShot(0, this, SLOT(hide()));
event->ignore();
}
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks