"Windows Programming" micro-technology report One

Source: Internet
Author: User

the Windows Programming Micro Technology report One

Rich Text Document

new elements can be created and inserted by using the Qtextcursor is implemented programmatically, or through Qtextedit in the form of user visual editing. The element can either specify a particular style when it is created, or directly use the style of the current cursor position.

The basic structure of the document is that the top level of the document determines how the layout is displayed. Each document includes a root frame and at least one block of text. For documents that contain multiple text content, the root framework typically contains a series of blocks and other elements. In a document, the order of frames and tables is separated by a block of text. Sometimes these text blocks have no content at all. This ensures that new elements can always be inserted between the original structures.

The Qtextdocument class contains all the information for a rich text document. As mentioned earlier, the document can be accessed in two ways: the linear cache (linear buffer) used by the editor and the object hierarchy (object hierarchy) that makes it easy for the layout engine to use. In a hierarchical document model, objects are used to describe visual elements, such as frames, tables, and lists. At a lower level, these elements have their own descriptive properties, such as text style and alignment. The linear description of the document is used to edit and maintain the document content.

Although Qtextedit provides convenient rich text display and editing capabilities, but documents can also be used independently from any of the editing components. For example:

Qtextdocument *newdocument = new Qtextdocument;

Alternatively, it can be obtained through the existing text components:

Qtextedit *editor = new Qtextedit;

Qtextdocument *editordocument = Editor->document ();

This flexibility allows applications to manipulate multiple documents simultaneously without having to include multiple document components, or requiring documents to be stored in some intermediate format.

An empty document contains a root frame that contains an empty block of text. The framework provides logical segmentation of different parts of the document, as well as the properties that are displayed when rendering. A table is a special framework that contains multiple cells that are distributed across different rows and columns. Each cell can contain more structure and text. The table provides the characteristics of the management and layout of the flexible hive.

A text block contains a text fragment. Each text fragment has specific text and character formatting information. Text properties are defined at the character level and block level. You can specify the font, color, and size at the character level. At the block level, you can specify a higher level of behavior, such as text flow direction, alignment, and background color.

The document structure is not directly maintained, but it needs to be edited through the cursor-based interface. The document cursor interface automatically inserts a new document element into the root frame and ensures that the element has a suitable empty block if necessary.

We can access the root framework in the following ways:

Qtextdocument *textdocument;

Qtextframe *root = Textdocument->rootframe ();

When document structure navigation is required, it is sometimes possible to start with the root framework. Because the root framework provides the ability to access the entire document structure.

"Windows Programming" micro-technology report One

Related Article

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.