Hello,
I have a Windows application that places an icon in the System Tray (modified the old trayicon example to work under Qt4). My question is; When I minimize my application, I want to remove it from the taskbar. I couldn't figure out how to do this using the changeEvent or hideEvent (I think because it's a spontaneous event). To solve this, I ended up having to reimplement the winEvent function as such:
bool winEvent( MSG *m, long *result )
{
if ( mintotray )
{
switch ( m->message )
{
case WM_SIZE:
{
if ( m->wParam == SIZE_MINIMIZED )
{
ShowWindow(winId(), SW_HIDE);
return true;
}
}
break;
default:
break;
}
}
return QWidget::winEvent(m, result
);
}
bool winEvent( MSG *m, long *result )
{
if ( mintotray )
{
switch ( m->message )
{
case WM_SIZE:
{
if ( m->wParam == SIZE_MINIMIZED )
{
ShowWindow(winId(), SW_HIDE);
return true;
}
}
break;
default:
break;
}
}
return QWidget::winEvent(m, result);
}
To copy to clipboard, switch view to plain text mode
Is there a cleaner way to do this using Qt events?
Thanks in advance,
-d
Bookmarks