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

演示

相关推荐
蒸蒸yyyyzwd1 小时前
关于 AI 开发相关的一些面经。
笔记·学习
MOONICK1 小时前
QT元数据
开发语言·qt
坤坤子吖7 小时前
Linux网络编程:TCP服务器的多进程与多线程实现
linux·服务器·开发语言·网络·c++·笔记·学习
蒸蒸yyyyzwd9 小时前
后端相关学习笔记。
笔记·学习
旖旎夜光9 小时前
【C++ 基础入门】C++ 多态(上):虚函数、重写、override/final 与抽象类
开发语言·c++·笔记·学习
橙橙笔记12 小时前
QT的学习第四部分
linux·qt·学习·音视频
叼烟扛炮12 小时前
Linux 学习笔记(五十四):内网穿透实战——用 frp 让外网访问你的私人电脑
linux·服务器·网络·笔记·学习
在猴站学算法12 小时前
(《统计学习方法》(第2版) 李航)第2章 感知机算法
学习·算法·机器学习·统计学习
旖旎夜光13 小时前
【C++ 基础入门】C++ 继承(上):概念、切片、隐藏、默认成员函数与友元
c++·笔记·学习
Godspeed Zhao13 小时前
从零开始学AI24——无监督学习之K均值
学习·机器学习