@why_bother said in Set icon for top left title bar of all windows and taskbar:
I've looked at https://doc.qt.io/qt-6/appicon.html that mentions setIcon() and I'm totally confused, as I don't understand what the difference between setIcon() and setWindowIcon() is, let alone which one I'm supposed to use.
setIcon() is for QWindow, which we usually don't use directly.
setWindowIcon() is for QApplication, it will call QWindow::setIcon() internally for every window.
As for the linked documentation, it is actually for changing the icon of the executable file, so it need to be configured in the project file, instead of in the code, and need to be certain icon format, instead of any picture format.
When the executable file icon is set successfully, it should become the default window icon for QApplication, so there would be no need to call QApplication::setWindowIcon() or QWindow::setIcon() if you only have one icon to show. (This is my experience on Windows, not sure if Linux is the same case.)