Anyone?....
Anyone?....
you can try like how I did it.
Qt Code:
void if (Settings::enableSystemTray()) { if (Settings::minimizeToTrayOnClose()) { hide(); event->ignore(); } } else { } }To copy to clipboard, switch view to plain text mode
Can you explain what that does? And how to call it(send an event)
closeEvent is called when the underlaying window system wants to close the main window. On windows by Alt-F4 or the close button.
If enabled in the program's settings, you would provide the main window to be closed at all, but only be minimized to the tray.
Oh... so it hides the window but doesnt close it... (what was I thinking...) but thats not what I need..
I want my window to be shown, but remove the taskbar button.
Maybe something like
Qt Code:
void trayIcon->hide(); } } void trayIcon->show(); } }To copy to clipboard, switch view to plain text mode
(Assumed, neither tested nor knowed)
Ok, will take a look at it
That's not it. I dont want to hide the trayIcon. I want to hide the taskbar button.
As the taskbar content is managed by the explorer.exe, this is something deep inside of your Vista...
I believe there was something that the taskbar entry was not shown when the main window of the app had no frame
Qt Code:
setWindowFlags(Qt::FramelessWindowHint);To copy to clipboard, switch view to plain text mode
Another approach is shown on Codeguru. This example uses the MFC, but also explains what has to be done.
mine is already set to Qt::FramelessWindowHint, doesnt change it. So I guess the solution is OS dependant.
I've never seen any explorer.exe on my system, so... yesIndeed, I think it is window manager dependent.
here is how to hide the taskbar button, it was already explained to you in one of the earlier posts:
Qt Code:
hide(); event->ignore(); }To copy to clipboard, switch view to plain text mode
notice that you'll have to subclass QMainWindow, here mymainwindow is subclass of QMainWindow..if you have any other questions, go through this thread again, your problem has already been solved.
ok, so normally the way it works is when you have your window maximised, you dont have any tray icon..when you close the window, the taskbar button disappears and tray icon appears..then you double click the tray icon or choose maximise from its context menu, and the window appears and taskbar button appears..isnt that how you want it? if you do, close event would be called when you click close icon of window..or you can call it yourself if you want your application to start minimized..remember that when window is shown, taskbar button would always be there, there is no way to avoid that and i dont understand why anyone would even want that..you can use showEvent, hideEvent, closeEvent as mentioned in the posts..closeEvent code that i posted earlier would close your window and remove the taskbar button, right then you have to show the tray icon in tray, add that code..further, you can use the code posted by Fastman to work out the context menu of the tray icon..and you have your job done.
QSplashScreen removes the taskbar button, but nothing usefull can happen there.
Bookmarks