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

演示

相关推荐
qq_3863226932 分钟前
华为网路设备学习-33(BGP协议 八)BGP路由 选路规则
学习·华为
xy_recording1 小时前
学习番外:Docker和K8S理解
学习·docker·kubernetes
DdduZe1 小时前
9.11作业
c++·qt
鱼嘻1 小时前
西嘎嘎学习 - C++ 继承 - Day 10
开发语言·c++·学习·算法
Hello_Embed1 小时前
STM32HAL 快速入门(二十四):I2C 编程(一)—— 从 OLED 显示初识 I2C 协议
c语言·stm32·单片机·嵌入式硬件·学习
-凌凌漆-2 小时前
【Qt】【C++】虚析构函数及 virtual ~Base() = default
java·c++·qt
枫叶丹42 小时前
【Qt开发】显示类控件(二)-> QLCDNumber
开发语言·qt
凯尔萨厮2 小时前
Java学习笔记四(继承)
java·笔记·学习
ホロHoro2 小时前
学习笔记:Javascript(5)——事件监听(用户交互)
javascript·笔记·学习
爱喝水的鱼丶2 小时前
SAP-MM:SAP核心组织单元:工厂(Plant)全面学习指南及配置图解
学习·sap·abap·配置·工厂·mm模块