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

演示

相关推荐
皮蛋sol周4 分钟前
嵌入式学习数据结构(二)双向链表 内核链表
linux·数据结构·学习·嵌入式·arm·双向链表
代码游侠10 分钟前
应用——基于 51 单片机的多功能嵌入式系统
笔记·单片机·嵌入式硬件·学习·51单片机
亦复何言??15 分钟前
DreamWaQ - 基于隐式地形想象的鲁棒四足机器人运动学习
学习·机器人
不会c嘎嘎22 分钟前
QT中的事件机制
开发语言·qt
涛起云永28 分钟前
Qt 源码编译 -- obj文件无法找到
开发语言·qt
后来后来啊32 分钟前
2026.1.18学习笔记
笔记·学习
wdfk_prog33 分钟前
[Linux]学习笔记系列 -- [drivers][base]core
linux·笔记·学习
小李子呢021136 分钟前
Node.js
开发语言·前端·学习·node.js
鱼很腾apoc37 分钟前
【实战篇】 第13期 算法竞赛_数据结构超详解(上)
c语言·开发语言·数据结构·学习·算法·青少年编程
KakiNakajima37 分钟前
Java结合AI技术学习总结【kaki与时俱进】
学习