Results 1 to 2 of 2

Thread: Structuring a document with QTextFrame

  1. #1
    Join Date
    Jul 2018
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11

    Question Structuring a document with QTextFrame

    Hello,
    I want to have a editor for a kind of specific structured document. I'm start from the textedit example.
    I hope to create QTextFrame to represent some sections.
    But I didn't find any way to do that.
    In fact I find no way to create QTextFrame outside the previous one. Each new Frame I create with insertFrame to QTextCursor is inside the previous one, even if I place the cursur with atEnd or atStart
    I use Python3 and Qt5, but don"t think that Python is different for this matter.

  2. #2
    Join Date
    Jul 2018
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Structuring a document with QTextFrame

    Hello,
    I found the solution.
    I have first to get the root frame:
    rootframe = mytextEdit.document().rootFrame()
    then to place the cursor at end:
    cursor = rootframe.lastCursorPosition()
    and I can now insert a new frame:
    cursor.insertFrame(frameFormat)
    Of course frameFormat is set before.

    Found in http://doc.qt.io/qt-4.8/http://doc.qt.io/qt-5/richtext-cursor.html

Similar Threads

  1. Deleting a QTextFrame in a QTextDocument
    By enno in forum Qt Programming
    Replies: 3
    Last Post: 13th November 2015, 09:12
  2. Structuring QGLWidget Program
    By Talguy in forum Newbie
    Replies: 1
    Last Post: 18th December 2010, 15:44
  3. Replies: 0
    Last Post: 11th November 2010, 08:58
  4. QTextFrame::iterator richtext QTextDocument problem?
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 20th July 2007, 01:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.