如何使光标"True Transparent"窗口,最好是在纯QML上?(Qt 5.7)

How to make a "True Transparent" window to cursor, preferably on a pure QML? (Qt 5.7)

本文关键字:QML Qt True 光标 何使 Transparent 窗口      更新时间:2023-10-16

" true透明度"解释(图像,76kb)。

在该图像上 applicationWindow 具有视觉透明层。但是实际上,光标不会转到 applicationWindow 后面的窗口(在这种情况下 - QT创建者)。

如果添加(uncommunt)" qt.windowtransparentforinput"标志,则可以实现" true透明度",但是按钮不再可用(很明显,我知道)。

我尝试了具有相似含义的各种标志(来自文档),但没有找到工作组合 - 当它位于窗口的边界内时,光标一直处于"默认"状态(必须在"文本"状态中,因为那是下面的文本)。

有人面对类似问题吗?您是否找到了解决方案?谢谢!

图像中的代码,其他项目文件保持未触及(QT快速控制2应用程序):

import QtQuick 2.7
import QtQuick.Controls 1.5
ApplicationWindow {
    visible: true
    width: 320
    height: 240
    x: 400
    y: 210
    color: "transparent"
    flags: Qt.Widget | Qt.FramelessWindowHint //| Qt.WindowTransparentForInput
    //| Qt.WA_TranslucentBackground //| Qt.WA_NoSystemBackground
    //| Qt.WA_NoBackground //| Qt.WA_MouseNoMask
    Button {
        x: ApplicationWindow.width - width
        text: "Right Top Window Corner"
    }
    Button {
        y: ApplicationWindow.height - height
        text: "Left Bottom Window Corner"
    }
}

一种解决方案是创建一个3窗口,一个用于透明区域,一个用于每个按钮。

import QtQuick 2.4
import QtQuick.Controls 1.5
import QtQuick.Window 2.0
ApplicationWindow {
    id: app
    visible: true
    width: 320
    height: 240
    x: 400
    y: 210
    color: "transparent"
    flags: Qt.Widget | Qt.FramelessWindowHint | Qt.WindowTransparentForInput | Qt.WindowStaysOnTopHint
    Window {
        visible: true
        flags: Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
        x: app.width - width
        height: rightButton.implicitHeight
        Button {
            id: rightButton
            text: "Right Top Window Corner"
        }
    }
    Window {
        visible: true
        flags: Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint
        y: app.height - height
        height: leftButton.implicitHeight
        Button {
            id: leftButton
            text: "Left Bottom Window Corner"
        }
    }
}