Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] QTextEdit::undo or QTextDocument::undo

[Solved] QTextEdit::undo or QTextDocument::undo

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    IIOffensiveII
    wrote on last edited by
    #1

    Hi everybody.

    I'm new to Qt and reading some books.
    One of the books I read, there is a text editor example.

    Somewhere in the code, the author uses

    @textEdit->document()->undo();@

    for an undo operation where document() returns a QTextDocument object.
    However, I realized that QTextEdit already has an undo function and does the same thing.
    Now, sorry for that easy question but is there a difference between them ?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      High and welcome to devnet,

      QTextEdit's undo will do some internal stuff and call undo on it's document. Calling undo directly on the document will by-pass QTextEdit's internal handling.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • I Offline
        I Offline
        IIOffensiveII
        wrote on last edited by
        #3

        Thank you for your reply.
        It is clearer now.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved