简体   繁体   中英

QT/QML How to create a frameless window with aero (blurred) background

Following code create a window in QML with Aero background (transparent and blurred).

import QtQuick 2.4
import QtQuick.Window 2.2
import QtWinExtras 1.0 as Win

Window{
    width: 500
    height: 300
    visible: true
    x: 500
    y: 100

    Win.DwmFeatures {
        topGlassMargin: -1
        leftGlassMargin: -1
        rightGlassMargin: -1
        bottomGlassMargin: -1
    }
}

When i add the following line to remove borders and title bar, the blur aspect also go off.

flags: Qt.Window|Qt.FramelessWindowHint

How to maintain the glass blur effect when no border is visible?

在此处输入图片说明

You can remove the title bar and the buttons using Qt.CustomizeWindowHint :

Window {
    ...

    Component.onCompleted: {
        flags = (flags | Qt.CustomizeWindowHint) & ~Qt.WindowTitleHint
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM