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

演示

相关推荐
数智工坊1 天前
机器人运动控制:采样、优化与学习三大流派深度对比与实战
android·学习·机器人
ZC跨境爬虫1 天前
跟着 MDN 学JavaScript day_7:数学运算与逻辑判断实战测试
开发语言·前端·javascript·学习·ecmascript
MartinYeung51 天前
[论文学习]隐私保护联邦特徵选择与差分隐私的的工程实践框架
学习
qeen871 天前
【C++】类与对象之类的默认成员函数(二)
android·c语言·开发语言·c++·笔记·学习
满天星83035771 天前
【Qt】信号和槽(二) (自定义信号和槽)
开发语言·数据库·qt
Flandern11111 天前
Pull Requests(PR)
学习·github·pr
Jun6261 天前
QT(19)-VISA控制仪器
开发语言·qt
nashane1 天前
HarmonyOS 6学习:JsCrash“闪退”法医指南——从FaultLog堆栈还原崩溃现场的终极手册
学习·华为·harmonyos
for_ever_love__1 天前
UI学习:UICollectionView瀑布流
学习·ui·ios·objective-c·cocoa
AOwhisky1 天前
MySQL 学习笔记(第六期):MySQL 备份与恢复
运维·数据库·笔记·学习·mysql·云计算