【发布时间】:2017-02-01 21:23:40
【问题描述】:
Qt5.7 这个例子给出了“指针”光标,但是 Qt5.8,我得到了“ibeam”光标(就像我要插入一样)。
import QtQuick 2.7
import QtQuick.Controls 2
ApplicationWindow
{
width: 1024
height: 800
visible: true
Flickable
{
anchors.fill: parent
flickableDirection: Flickable.VerticalFlick
TextArea.flickable: TextArea
{
font.pixelSize: 25
text: "hello world"
readOnly: true
}
}
}
这是有意更改吗,如果是,我如何显示只读 TextArea 的指针光标?
谢谢。
更新 #1:
添加一个虚拟MouseArea 似乎可以修复它。我不知道为什么/
像这样:
Flickable
{
anchors.fill: parent
flickableDirection: Flickable.VerticalFlick
TextArea.flickable: TextArea
{
font.pixelSize: 25
text: "hello world"
readOnly: true
MouseArea
{
anchors.fill: parent
enabled: false
}
}
}
【问题讨论】:
-
听起来像是一个应该很容易修复的疏忽。请在 bugreports.qt.io 报告。
-
@jpnurmi 谢谢。我找到了一种解决方法,但我不明白它为什么有效。无论如何...
-
可能是因为
MouseArea的默认cursorShape是Qt.ArrowCursor:doc.qt.io/qt-5/qml-qtquick-mousearea.html#cursorShape-prop。顺便说一句,你能回答你的问题并接受它,这样我们就知道它已经解决了吗? :) -
该错误已在 Qt 5.8.1 和/或 5.9.0 中修复:codereview.qt-project.org/#/c/185002
-
感谢您的错误修复!我同时发布了这个效果的答案和我的解决方法。
标签: qt qml qtquickcontrols2 qt5.8