[Qt-interest] [BUG]QTextCuror::inserFrame() inserts block

Girish Ramakrishnan girish at forwardbias.in
Tue Apr 7 14:34:02 CEST 2009


Israel Brewster wrote:
> When calling QTextCursor::insertFrame(QTextFrameFormat), an extra empty
> block is inserted before the frame, even though
> QTextCursor::insertBlock() was never called. From what I have been able
> to determine, there is no way to work around this behavior, meaning that
> if you want to use a frame there will always be a blank line before it,
> even if this is undesirable. There are, of course, any number of
> situations in which one may want a blank line before a frame, but in
> those situations you should call QTextCursor::insertBlock() explicitly.
> No command should do something that was not explicitly requested without
> some easy and obvious way to disable the functionality, even if the
> function is "usually" desired - I would definitely consider this a bug,
> unless I am just missing some way to disable it.
> 

Can you show the code which reproduces the above? Are you saying that
the below creates a block between foo and bar?:
cur.insertText("foo");
cur.insertFrame(QTextFrameFormat());
cur.insertText("bar");

The above works just fine in 4.4.

Note that a text document always contains a frame and a frame always
contains a block. This means that if you insertFrame in an empty text
document, it will appear as though an empty block has been inserted
before it (when the fact is that the empty block was always present to
start with).

Girish



More information about the Qt-interest-old mailing list