0

Could someone help me to figure out the relations between QTextEdit, QTextDocment, QTextBlock, QTextFrame, etc.?

I need an overview,thank you in advance.

I just want to have a thorough knowledge of QTextEdit. Perhaps someone want to mark me as lazy because I can figure it out by reading qt-project documents. Yes, it is right and I am doing it. But maybe it is not a trivial thing for me.

Marek R
  • 32,568
  • 6
  • 55
  • 140
waterd
  • 603
  • 1
  • 7
  • 23

2 Answers2

4

QTextEdit is a widget that displays a QTextDocument which has one root QTextFrame, consists of QTextBlocks and can have child QTextFrames.

Oleh Prypin
  • 33,184
  • 10
  • 89
  • 99
1

using MVC design pattern QTextEdit is a view (and partially controller) and QTextDocment is a model.

So QTextDocment is just a container for the text data and layout of text. QTextBlock represents a single paragraph in document. QTextCursor is a tool to perform any modifications in text document (model).

I recommended to read documentation it is pretty good.

Marek R
  • 32,568
  • 6
  • 55
  • 140
  • Thanks you for telling me **QTextEdit** is a view.I knew MVC in Qt but I din't have a clear knowledge of the Qt's MVC hierarchy.I also think Qt's official documents are pretty good.I have lots to do. – waterd Sep 05 '14 at 11:37
  • Do you have any ideas about how to give `QTextFrame` or `QTextBlock` a background image? I wan to show texts on a specified image in `QTextEdit`. – waterd Sep 09 '14 at 08:46