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

演示

相关推荐
Aliex_git18 分钟前
浏览器 API 兼容性解决方案
前端·笔记·学习
四谎真好看30 分钟前
SSM学习笔记(Spring篇 Day02)
笔记·学习·学习笔记·ssm
瞎某某Blinder4 小时前
DFT学习记录[3]:material project api使用方法 mp_api调取与pymatgen保存
java·笔记·python·学习
学编程的闹钟4 小时前
PHP编程高手的信息检索与文档查阅秘籍
学习
im_AMBER4 小时前
Leetcode 119 二叉树展开为链表 | 路径总和
数据结构·学习·算法·leetcode·二叉树
Laurence5 小时前
从 code.qt.io 下载单个示例项目(一个目录/文件夹)
qt·目录·下载·文件夹·示例项目
白开水丶5 小时前
vue3源码学习(五)ref 、toRef、toRefs、proxyRefs 源码学习
前端·vue.js·学习
不光头强5 小时前
SpringBoot 开发第三天 学习内容
java·spring boot·学习
Coisinilove6 小时前
MATLAB学习笔记——第二章
笔记·学习·matlab
Titan20246 小时前
C++异常学习笔记
c++·笔记·学习