Hi, I'm a beginner in PyQt. I was trying to create a simple app to try some of the toolkit's many features. My question is, how can I hide the app icon from the taskbar? I don't want the user to be able to see the icon in taskbar and to minimize it using this icon. Is there any window flags that I can use to achieve this?
I wouldn't recommend trying to hide an application's taskbar presence, especially if the application is visible. If you are only trying to prevent minimizing from the taskbar then you can achieve this by creating your top level widget with the following window flags like this:
QWidget *mainWindow = new QWidget(0, Qt::CustomizeWindowHint
| Qt::WindowTitleHint | Qt::WindowSystemMenuHint
| Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint);
If you don't want a maximize flag, you can leave that one out of the list too.
The various window flags that Qt can use are documented here (Qt::WindowFlags).
Since I'm working with PyQt, I tried initializing the app as follows:
QtGui.QMainWindow.__init__(self, parent, Qt.Qt.CustomizeWindowHint | Qt.Qt.WindowTitleHint | Qt.Qt.WindowSystemMenuHint | Qt.Qt.WindowCloseButtonHint | Qt.Qt.WindowMaximizeButtonHint)
But this didn't prevent me from minimizing the window, or maximizing it, from the taskbar icon. What all changes should I make here?
Also I wanted to make the app work like a desktop widget. May be I'll add a sys tray icon. But I'd still like to hide the taskbar icon if possible, so that the app is visible in desktop and it doesn't distract the user with a taskbar icon.