QQuickWindow transparent

前端 未结 3 1000
醉话见心
醉话见心 2021-01-05 02:40

im using QQmlApplicationEngine with QQuickWindow for an application and i can\'t transparent main window. i want to set a splash before application pops up and i use Window

3条回答
  •  独厮守ぢ
    2021-01-05 03:19

    I know this is an old question, but as it is not marked as solved, here is my approach:

    import QtQuick 2.4
    import QtQuick.Controls 1.3
    
    ApplicationWindow {
        title: qsTr("Hello World")
        width: 640
        height: 480
        flags: Qt.FramelessWindowHint
        color: "transparent"
        visible: true
        Rectangle
        {
            color:"red"
            width: parent.width/2
            height: parent.height/2;anchors.centerIn: parent
        }
    }
    

    As result, you will get a transparent background with a red rectangle in the middle. You could easily change that rectangle for an image.

    Hope helped someone.

提交回复
热议问题