大佬教程收集整理的这篇文章主要介绍了如何在我的 qt 快速应用程序中更改 android 上的默认文本编辑光标?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想更改文本编辑光标的默认形状,它应该如下图
TextArea {
ID: txtTalk
anchors.fill: parent
leftpadding: 9
rightpadding: 9
wrapMode: TextArea.Wrap
color: Material.color(Material.Red,Material.Shade900)
BACkground: Rectangle{
radius: 3
color: Material.color(Material.Red,Material.Shade50)
border.wIDth: 1
border.color: Material.color(Material.Red,Material.Shade300)
}
}
以下代码应该可以满足您的需求。您还可以添加闪烁动画,请查看此 cursorDelegate example。 QML 中 SVG 的唯一问题是糟糕的混叠。你可以做的是组合两个矩形的“销”,一个带有圆角(半径属性),另一个旋转。或者你可以看看如何在 QML 中摆脱 SVG 的锯齿。
除了使用 PathSVG,您还可以组合 PathLine 和 PathArc 的图钉图标。
请记住,我没有注意引脚的动态放置及其缩放,我调整了值直到它看起来没问题。另一件事是根据您的字体大小缩放图钉。
import QtQuick 2.0
import QtQuick.Controls 2.15
import QtQuick.Shapes 1.15
Item {
width: 640
height: 480
TextArea {
anchors.centerIn: parent
wrapMode: TextArea.Wrap
color: "gray"
font.pixelSize: 24
BACkground: Rectangle{
implicitWidth: 300
implicitHeight: 200
radius: 3
color: "white"
border.width: 1
border.color: "black"
}
placeholderText: qsTr("Enter description")
cursorDelegate: Item {
width: 1
Rectangle {
id: rectangle
color: "black"
y: 1
width: 2
height: parent.height - 2
Shape {
x: -8
y: rectangle.height + 2
ShapePath {
fillColor: "red"
strokeWidth: -1
scale: Qt.size(0.2,0.2)
PathSvg { path: "M 45,90 C 25.463,90 9.625,74.16@R_607_11224@.625,54.625 c 0,-8.722 3.171,-16.693 8.404,-22.861 L 45,0 71.97,31.765 c 5.233,6.167 8.404,14.139 8.404,22.861 C 80.375,74.162 64.537,90 45,90 Z" }
}
}
}
}
}
}
以上是大佬教程为你收集整理的如何在我的 qt 快速应用程序中更改 android 上的默认文本编辑光标?全部内容,希望文章能够帮你解决如何在我的 qt 快速应用程序中更改 android 上的默认文本编辑光标?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。