在该图像上,ApplicationWindow有一个可视透明层。但实际上,游标没有转到ApplicationWindow后面的窗口(在本例中是- QT )。
如果添加(取消注释) "Qt.WindowTransparentForInput“标志,则实现”真正的透明度“,但是按钮不再可用(我知道这是显而易见的)。
我尝试过各种具有类似含义的标志(从文档中),但没有找到一个有效的组合--当光标在窗口的边框内时,游标处于“默认”状态(必须处于“文本”状态,因为它下面是文本)。
有没有人遇到过类似的问题,你找到解决办法了吗?谢谢!
来自图像的代码,其他项目文件保持不变( Quick 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"
}
}发布于 2016-11-28 08:52:45
一种解决方案是创建一个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"
}
}
}https://stackoverflow.com/questions/40833624
复制相似问题