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

演示

相关推荐
Lynnxiaowen1 小时前
今天我们开始学习python语句和模块
linux·运维·开发语言·python·学习
Main. 242 小时前
从0到1学习Qt -- 创建项目
qt
橘子是码猴子2 小时前
LangExtract:基于LLM的信息抽取框架 学习笔记
笔记·学习
AnySpaceOne2 小时前
笔记本电脑如何连接打印机?完整连接教程送上
学习·电脑
dxnb223 小时前
Datawhale25年10月组队学习:math for AI+Task2线性代数
人工智能·学习·线性代数
wanfeng_093 小时前
python爬虫学习
爬虫·python·学习
A9better3 小时前
嵌入式开发学习日志39——stm32之I2C总线物理层与常用术语
stm32·单片机·嵌入式硬件·学习
报错小能手5 小时前
linux学习笔记(35)C语言连接mysql
linux·笔记·学习
jjjxxxhhh1235 小时前
【学习】USB摄像头 -> FFmpeg -> H264 -> AI模型
人工智能·学习·ffmpeg
_dindong5 小时前
笔试强训:Week -2
笔记·学习·算法