├── screenshot.png
├── qml.qrc
├── main.cpp
├── transparent-main-window.pro
├── README.md
├── main.qml
└── deployment.pri
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrewrjones/qt-transparent-main-window/master/screenshot.png
--------------------------------------------------------------------------------
/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 |
5 |
6 |
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | QGuiApplication app(argc, argv);
7 |
8 | QQmlApplicationEngine engine;
9 | engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
10 |
11 | return app.exec();
12 | }
13 |
--------------------------------------------------------------------------------
/transparent-main-window.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += qml quick
4 |
5 | SOURCES += main.cpp
6 |
7 | RESOURCES += qml.qrc
8 |
9 | # Additional import path used to resolve QML modules in Qt Creator's code model
10 | QML_IMPORT_PATH =
11 |
12 | # Default rules for deployment.
13 | include(deployment.pri)
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | qt-transparent-main-window
2 | ==========================
3 |
4 | Qt UI with a frameless window and rounded corners.
5 |
6 | See the Stack Overflow question: http://stackoverflow.com/questions/14780504/qt5-qtquick2-transparent-main-window
7 |
8 | Thanks to [Marcus Ottosson](http://stackoverflow.com/users/478949/marcus-ottosson) for providing the answer.
9 |
10 | 
11 |
--------------------------------------------------------------------------------
/main.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.3
2 | import QtQuick.Window 2.2
3 |
4 | Window {
5 | visible: true
6 | width: 360
7 | height: 360
8 | flags: Qt.FramelessWindowHint | Qt.Window
9 | color: "transparent"
10 |
11 | Rectangle {
12 | color: "brown"
13 | anchors.fill: parent
14 | anchors.margins: 10
15 | radius: 10
16 |
17 | MouseArea {
18 | anchors.fill: parent
19 | onClicked: {
20 | Qt.quit();
21 | }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/deployment.pri:
--------------------------------------------------------------------------------
1 | android-no-sdk {
2 | target.path = /data/user/qt
3 | export(target.path)
4 | INSTALLS += target
5 | } else:android {
6 | x86 {
7 | target.path = /libs/x86
8 | } else: armeabi-v7a {
9 | target.path = /libs/armeabi-v7a
10 | } else {
11 | target.path = /libs/armeabi
12 | }
13 | export(target.path)
14 | INSTALLS += target
15 | } else:unix {
16 | isEmpty(target.path) {
17 | qnx {
18 | target.path = /tmp/$${TARGET}/bin
19 | } else {
20 | target.path = /opt/$${TARGET}/bin
21 | }
22 | export(target.path)
23 | }
24 | INSTALLS += target
25 | }
26 | !host_build:QMAKE_MAC_SDK = macosx10.9
27 |
28 | export(INSTALLS)
29 |
--------------------------------------------------------------------------------