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

演示

相关推荐
凛铄linshuo14 分钟前
爬虫简单实操2——以贴吧为例爬取“某吧”前10页的网页代码
爬虫·python·学习
charlie11451419128 分钟前
深入理解Qt的SetWindowsFlags函数
开发语言·c++·qt·原理分析
大春儿的试验田1 小时前
高并发收藏功能设计:Redis异步同步与定时补偿机制详解
java·数据库·redis·学习·缓存
金色光环2 小时前
【Modbus学习笔记】stm32实现Modbus
笔记·stm32·学习
醇醛酸醚酮酯2 小时前
Qt项目锻炼——TODO清单(二)
开发语言·数据库·qt
THMOM912 小时前
TinyWebserver学习(9)-HTTP
网络协议·学习·http
凌辰揽月3 小时前
Servlet学习
hive·学习·servlet
Mr_Xuhhh3 小时前
信号与槽的总结
java·开发语言·数据库·c++·qt·系统架构
魔芋红茶4 小时前
spring-initializer
python·学习·spring
西岭千秋雪_4 小时前
Redis性能优化
数据库·redis·笔记·学习·缓存·性能优化