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();
                }
            }
        }
    }
}

演示

相关推荐
Chunyyyen2 分钟前
【第三十二周】RAG学习02
学习
强子感冒了12 分钟前
MySQL学习随笔:数据类型与字段约束
学习·mysql
tritone17 分钟前
学习Chef自动化配置管理工具,为了实践环境部署,我选择了**阿贝云**的**免费虚拟主机**和**免费云服务器**来搭建测试平台。
服务器·学习·自动化
xian_wwq36 分钟前
【学习笔记】特权账号管理(PAM)
笔记·学习·pam
星火开发设计36 分钟前
const 指针与指针 const:分清常量指针与指针常量
开发语言·c++·学习·算法·指针·const·知识
驱动探索者37 分钟前
AMD EPYC 服务器 CPU 学习
运维·服务器·学习·cpu
丝斯201141 分钟前
AI学习笔记整理(57)——大模型微调相关技术
人工智能·笔记·学习
曾浩轩1 小时前
图灵完备Turing Complete 9
学习·图灵完备
程序猿3651 小时前
动词大全整理
学习
编程大师哥1 小时前
新手学习编程从哪个语言开始
学习