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

演示

相关推荐
石像鬼₧魂石4 小时前
HexStrike-AI人工智能 渗透测试学习(Metasploitable2 192.168.1.4)完整流程总结
学习·ubuntu
非凡ghost4 小时前
MusicPlayer2(本地音乐播放器)
前端·windows·学习·软件需求
蓝桉~MLGT5 小时前
Ai-Agent学习历程—— 阶段1——环境的选择、Pydantic基座、Jupyter Notebook的使用
人工智能·学习·jupyter
杰米不放弃6 小时前
AI大模型应用开发学习-26【20251227】
人工智能·学习
执笔论英雄7 小时前
【RL】Megatron使学习forward_backward_func返回值
学习
幺零九零零8 小时前
压测学习-JMeter
学习·jmeter
程途拾光1588 小时前
自监督学习在无标签数据中的潜力释放
人工智能·学习
软件技术NINI8 小时前
JavaScript性能优化实战指南
前端·css·学习·html
Blossom.1189 小时前
多模态大模型LoRA微调实战:从零构建企业级图文检索系统
人工智能·python·深度学习·学习·react.js·django·transformer
会飞的胖达喵9 小时前
Qt自动信号槽连接机制:深入解析与应用实践
开发语言·qt