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] Mark QTextDocument as not modified
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Mark QTextDocument as not modified

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.2k 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.
  • S Offline
    S Offline
    sptrakesh
    wrote on last edited by
    #1

    Hello,

    I would like to update the modified property in QTextDocument once the contents of a QTextEdit/QPlainTextEdit have been saved to a file. I do not see any obvious way to go about doing that. In my close implementation I would like to check the modified status and show a notice to users that there are unsaved edits. I could of course maintain my own flag(s) and use it for my close implementation, but wanted to make sure I was not missing a built-in feature.

    Thanks
    Rakesh

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Have you tried "setModified":http://qt-project.org/doc/qt-5/qtextdocument.html#modified-prop ?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sptrakesh
        wrote on last edited by
        #3

        Yes, I had already tried that, only indirectly though. By constant casting the instance made available through the editor document method. I will test by keeping my own document and setting the editor with that instance.

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          [quote author="sptrakesh" date="1414969970"]By constant casting the instance made available through the editor document method.[/quote]
          Huh? The document() method of QTextEdit returns QTextDocument*. What do you need a const cast for?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sptrakesh
            wrote on last edited by
            #5

            Duh, you are right. Just read the const at the wrong place.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sptrakesh
              wrote on last edited by
              #6

              Found the issue, wrong connection :-(

              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