C++ 文本区域光标形状与其他项目重叠
我有一个C++ 文本区域光标形状与其他项目重叠,c++,qt,qml,C++,Qt,Qml,我有一个TextArea和弹出窗口或与之重叠的另一项。但当我指向弹出窗口时,光标形状并没有改变。当我指向重叠的项目时,我需要光标变成默认值 代码: import QtQuick 2.7 import QtQuick.Controls 2.1 ApplicationWindow { id: root visible: true width: 800 height: 600 Component.onCompleted: pop.open() T
TextArea
和弹出窗口或与之重叠的另一项。但当我指向弹出窗口时,光标形状并没有改变。当我指向重叠的项目时,我需要光标变成默认值
代码:
import QtQuick 2.7
import QtQuick.Controls 2.1
ApplicationWindow {
id: root
visible: true
width: 800
height: 600
Component.onCompleted: pop.open()
TextArea {
width: 800
height: 600
}
Popup {
id: pop
Rectangle {
color: "red"
width: 100
height: 100
}
MouseArea {
anchors.fill: parent
}
}
}
TextArea
包含一个设置不同光标形状的MouseArea
。光标形状始终由最顶端的
MouseArea
定义。因此,解决方案是在重叠的项中添加MouseArea
,以重置该区域的光标形状
import QtQuick 2.7
import QtQuick.Controls 1.4
ApplicationWindow {
id: root
visible: true
width: 800
height: 600
TextArea {
width: 800
height: 600
}
Rectangle {
color: 'red'
width: 100
height: 100
x: 100
y: 50
MouseArea { // This resets the cursor shape, if the cursor hovers over the Rectangle
anchors.fill: parent
}
}
}
该问题已在Qt 5.9中修复。
感谢欢迎使用堆栈溢出。请阅读创建最小、完整和可验证问题的说明。如果您使用的是Qt Quick Controls 2,请尝试最新的Q5.9测试版。通过为所有交互控件指定显式游标,该问题已得到解决。然后,您可以分享您的问题的代码示例吗?谢谢。我会检查它,只要我在我的机器与Qt 5.8再次。