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

演示

相关推荐
颜*鸣&空23 分钟前
QT程序实现串口通信案例
开发语言·qt
Main. 2437 分钟前
从0到1学习Qt -- 常见控件之显示类控件
qt·学习
e***193539 分钟前
爬虫学习 01 Web Scraper的使用
前端·爬虫·学习
二川bro5 小时前
多模态AI开发:Python实现跨模态学习
人工智能·python·学习
石像鬼₧魂石5 小时前
Netcat,网络瑞士军刀(新手学习备用)
学习
todoitbo6 小时前
基于 DevUI MateChat 搭建前端编程学习智能助手:从痛点到解决方案
前端·学习·ai·状态模式·devui·matechat
qq_401700417 小时前
Qt中事件循环与并发机制的协同工作
qt
Ma0407138 小时前
【机器学习】监督学习、无监督学习、半监督学习、自监督学习、弱监督学习、强化学习
人工智能·学习·机器学习
小熊officer9 小时前
Nginx学习
运维·学习·nginx
秋邱9 小时前
价值升维!公益赋能 + 绿色技术 + 终身学习,构建可持续教育 AI 生态
网络·数据库·人工智能·redis·python·学习·docker