Qt/QML学习-TextEdit

QML学习

main.qml

复制代码
import QtQuick 2.15
import QtQuick.Window 2.15

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    Rectangle {
        anchors.centerIn: parent
        width: textEdit.width
        height: textEdit.height
        color: "yellow"
        TextEdit {
            id: textEdit
            anchors.centerIn: parent
            text: "TextEdit"
            color: "red"
            font{
                pointSize: 30
                bold: true
            }
            selectByMouse: true
            selectionColor: "blue"
            cursorDelegate: Canvas {
                width: 4
                onPaint: {
                    var ctx = getContext('2d')
                    ctx.setLineDash([2, 2, 2])
                    ctx.lineWidth = 4
                    ctx.strokeStyle = "#444fff"
                    ctx.lineCap = "round"
                    ctx.beginPath()
                    ctx.moveTo(0, 0)
                    ctx.lineTo(0, height)
                    ctx.stroke();
                }
            }
        }
    }
}

演示

相关推荐
AI浩36 分钟前
人群计数的课程学习——是否值得:
学习
hmbbcsm1 小时前
python 学习之路(八)
学习
搞机械的假程序猿2 小时前
普中51单片机学习笔记-矩阵按键
笔记·学习·51单片机
却道天凉_好个秋2 小时前
音视频学习(七十):SVC编码
学习·音视频
Mr.Jessy2 小时前
Web APIs 学习第六天:BOM、location对象与本地存储
开发语言·前端·javascript·学习·web api·bom
Mark Studio3 小时前
QT linux 静态编译问题记录
开发语言·qt
呜呜。3 小时前
WebSocket-学习调研
websocket·网络协议·学习
Tonya433 小时前
测开学习DAY28
学习
Lynnxiaowen4 小时前
今天我们开始学习ansible之playbook的简单运用
linux·运维·学习·云计算·ansible
心无旁骛~4 小时前
MotionTrans: 从人类VR数据学习机器人操作的运动级迁移
学习·机器人·vr