The TextEdit of QML

Source: Internet
Author: User

TextEdit Displays an editable, formatted text box. It can also display plaintext and rich text. For example:
TextEdit {
width:240
Text: "<b>Hello</b> <i>World!</i>"
font.family: "Helvetica"
Font.pointsize:20
Color: "Blue"
Focus:true
}

Set focus to True to allow TextEdit to accept keyboard focus.
Note: The text edit box does not implement scrolling, cursor manipulation, and other behaviors that are specific to the senses. For example, add flickable scroll to follow the cursor:
flickable {
Id:flick

width:300; height:200;
ContentWidth:edit.paintedWidth
ContentHeight:edit.paintedHeight
Clip:true

function EnsureVisible (R)
{
if (ContentX >= r.x)
ContentX = r.x;
else if (contentx+width <= r.x+r.width)
ContentX = R.x+r.width-width;
if (Contenty >= r.y)
Contenty = R.Y;
else if (contenty+height <= r.y+r.height)
Contenty = R.y+r.height-height;
}

TextEdit {
Id:edit
Width:flick.width
Height:flick.height
Focus:true
WrapMode:TextEdit.Wrap
OnCursorRectangleChanged:flick.ensureVisible (Cursorrectangle)
}
}
A particular sensory may use smooth scrolling (for example, using smoothedanimation), possibly another visible scrollbar, or a scroll bar that fades to the display, and so on.
Clipboard support can provide cut (), copy (), paste () functions, selection can rely on settings selectbymouse to handle various kinds of information in the traditional mouse mechanism. Complete processing is accomplished by setting the starting position and terminating position, or using SelectAll () or Selectword ();
You can convert between the cursor position and the pixel point by Positionat () and Positiontorectangle ().
For details, see Text and TextInput.

Properties Document:
Activefocusonpress:bool
TextEdit whether the activation focus event should be added when the mouse is pressed. This setting is true by default.

Baseurl:url
This property has been developed for a textual text in which the basic is used to solve related texturl.
The default value is QML instantiated The URL of the TextEdit project.

Canpaste:bool
Returns True if TextEdit is writable and the contents of the Clipboard are appropriate to post to TextEdit.

Canredo:bool
Returns the true value if TextEdit is enabled to be editable and can indeed allow redo operations here.

Canundo:bool
Returns True if TextEdit is editable and has the money an operation goes to allow the undo operation.

Color:color
The text color.
Green text using hexadecimal notation
TextEdit {color: "#00FF00"}
Steelblue text using SVG color name
TextEdit {color: "Steelblue"}

Contentheight:real
Returns the height of the text, including those height values that are overwritten because the text does not fit the set height.

Contentwidth:real
Returns the width of the text , including those in the past due to insufficient wrapping, and the WrapMode has been set, and the height of the overlay.

Cursordelegate:component
Edit the cursor proxy in the text box.
If cursordelegateis set for a text edit box, the proxy will be used as a new cursor to replace the standard cursor. When a cursor is required, An instance of the delegate is created and managed through a text editor, and the properties X and y of the proxy are set and used as a pixel in the upper-left corner of the current character.
Note: The root project of the agent component must be a qquickitem or Qquickitem device project.

Cursorposition:int
position of the cursor in the text edit

Cursorrectangle:Rectangle





The TextEdit of QML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.