日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

QML笔记-TextEdit的使用

發(fā)布時間:2025/3/15 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 QML笔记-TextEdit的使用 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

目錄

?

?

基本概念

代碼與實例


?

基本概念

一般在TextEdit上套一個Flickable使其具有滑動效果。

再把TextEdit中wrapMode設(shè)置為TextEdit.Wrap,使其不在一行。

并且把textFormat設(shè)置為TextEdit.RichText,使其能顯示富文本。

?

?

代碼與實例

程序運行截圖如下:

這里富文本框有滑動的效果。

點擊紅色的地方,會打印富文本

代碼如下:

import QtQuick 2.9 import QtQuick.Window 2.2Window {visible: truewidth: 640height: 480title: qsTr("Hello World")Flickable{id : mFlickableIdwidth : textInputId.widthcontentHeight: textInputId.implicitHeightheight: 300clip: trueanchors.centerIn: parentTextEdit{id: textInputIdwidth: 240text: "<strong>Because</strong> we want to use our server locally, we set "+"our domain name \r to be <font color = 'red' >localhost </font>. If we had set it up "+" to\n be something else, we would have to go mess with"+" the host files to resolve whatever we put in here to"+" a recognizable network address. "+"ustleaveinlocalhostitisgoodenoughforourlocalusepurposes."+" Leave the rest to defaults and hit continue. You are then"+" given a choice for the database you want to use"wrapMode: TextEdit.WraptextFormat: TextEdit.RichTextfont.family: "Helvetica"font.pointSize: 20color: "blue"focus: trueonEditingFinished: {console.log("The current text is :"+ text)}}}Rectangle {id : mRectIdwidth: 200height: 100color: "red"anchors.top: mFlickableId.bottomMouseArea{anchors.fill: parentonClicked: {console.log("The new text is :"+textInputId.text)}}} }

?

總結(jié)

以上是生活随笔為你收集整理的QML笔记-TextEdit的使用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。