title: Qt5 & QtQuick2 - transparent main window
body: <p>I am trying to create a simple Qt UI with a frameless window and rounded corners. Starting from a new project with the <em>QtQuick 2 Application</em> template, my code looks like this:</p>
  
  <p><em>main.cpp</em></p>
  
  <pre><code>#include &lt;QtGui/QGuiApplication&gt;
  #include "qtquick2applicationviewer.h"
  
  int main(int argc, char *argv[])
  {
      QGuiApplication app(argc, argv);
  
      QtQuick2ApplicationViewer viewer;
  
      viewer.setMainQmlFile(QStringLiteral("qml/qtquick-test/main.qml"));
      viewer.setFlags(Qt::FramelessWindowHint);
      viewer.showExpanded();
  
      return app.exec();
  }
  </code></pre>
  
  <p><em>main.qml</em></p>
  
  <pre><code>import QtQuick 2.0
  
  Rectangle {
      width: 360
      height: 360
      radius: 10
      color: "red"
  
      Text {
          text: qsTr("Hello World")
          anchors.centerIn: parent
      }
      MouseArea {
          anchors.fill: parent
          onClicked: {
              Qt.quit();
          }
      }
  }
  </code></pre>
  
  <p>And this is the result:</p>
  
  <p><img src="https://i.stack.imgur.com/9xAO2.png" alt="And this is the result"></p>
  
  <p>What I wan't to do is get rid of the white corners, by making the main window transparent. However, as far as I can tell there is no way in Qt5 to do this, because we don't have stylesheets, etc and I am not using a QtWidget. Should I use a QtWidget?</p>
  
  <p>Btw, I'm new to Qt and Qt5.</p>