Qt - minimizing and maximizing app without standard titlebar buttons
<p>I have a Qt application where there is only one widget which is not a <code>MainWindow</code>, just a <code>QLabel</code>. It has not title bar (obtained through <code>setWindowFlags(Qt::FramelessWindowHint)</code>), thus the standard minimize and maximize buttons are not available. But there is a sidebar at the widget's side where we provide a minimize button that should behave as the standard minimize button.</p>

<p>How do I do it?</p>

<p>I tried the solutions at <a href="https://stackoverflow.com/questions/3599334/minimizing-a-qt-application">Minimizing a Qt application</a> and <a href="https://stackoverflow.com/questions/8271501/qt-c-minimize-and-maximize-window">Qt C++ minimize and maximize window</a>. Neither works. I can hide the app of course, on clicking the minimize button. Problem is, how to restore it through standard mechanisms?</p>

<p>Scenarios:</p>

<ol>
<li><p>On Mac, the dock icon is clicked. Thankfully, OS X native APIs can give me a notification when dock icon is clicked, so based on that, I can unhide the widget and make it active.</p></li>
<li><p>On Mac, the app icon is double clicked in <code>/Applications</code>, or clicked in <code>Launchpad</code>. How do I get a notification for this? The code doesn't even come to the <code>main.cpp</code> that I can unhide it from there if it is hidden.</p></li>
<li><p>On Windows, the application icon in the taskbar is clicked (the app does not have a tray icon). How do I get notification for that and unhide it?</p></li>
<li><p>On Windows, the app icon is double clicked either in Program Files, or may be a desktop shortcut icon. How do I get notification for this to unhide it?</p></li>
</ol>

<p>If this aproach is not correct, how do I show and hide the app as per standard behavior on both Mac and Windows?</p>

<p>Platform - Qt 5.3.1, 32 bit.</p>