title: How to make Qt Application mainwindow to remain always on top of other windows in Windows OS?
body: <p>Platform - Windows 7,8,10</p>
  
  <p>I have created a QApplication from QMainWindow.
  I want it to remain always on top of all other windows.</p>
  
  <p>I have used Qt flags ( Qt::WindowStaysOnTopHint ) to achieve this.
  But this Qt flag does not work.
  The application is a frameless application.</p>
  
  <p>Please find below the code of the constructor of my Qt App.</p>
  
  <pre><code>myApp::myApp(QWidget *parent)
  : QMainWindow(parent)
  {
  setWindowFlags(Qt::Widget |  Qt::FramelessWindowHint);
  setWindowFlags(this-&gt;windowFlags() | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint );
  ui.setupUi(this);
  }
  </code></pre>
  
  <p>How can I make this flag work ?</p>
  
  <p>I have tried all the options suggested by several members of the community.
  My present code is as follows</p>
  
  <pre><code>Qt::WindowFlags flags = this-&gt;windowFlags();
  this-&gt;setWindowFlags(flags  | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
  ui.setupUi(this);
  </code></pre>
  
  <p>Strange fact is that this never works on my machine.
  When I create an installer or copy the required files and run on a different machines(Windows 7, 8, 10) then I get my application on top of all other windows.
  Note: I am using Visual Studio Community Edition 2015
  OS - Windows 7 Professional Service Pack 1.</p>