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. How to get "-- Edited" to show up on Mac window when document has unsaved changes?
Forum Updated to NodeBB v4.3 + New Features

How to get "-- Edited" to show up on Mac window when document has unsaved changes?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.7k 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.
  • Thuan_FirelightT Offline
    Thuan_FirelightT Offline
    Thuan_Firelight
    wrote on last edited by
    #1

    Most resources online seems to suggest after setting the NSWindow::documentEdited property, the title should get the "-- Edited" (refer to TextEdit for the behavior) as well as the little dot on the close button. I can't seem to get the "-- Edited" to show up on my title after calling QMainWindow::setWindowModified(true). The close button does update correctly though. Has anyone managed to get that to work?

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

      Hi,

      Looking a the method's documentation It seems you have to set the window title with [*] that will be show when you set the property to true.

      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
      • Thuan_FirelightT Offline
        Thuan_FirelightT Offline
        Thuan_Firelight
        wrote on last edited by
        #3

        We are already doing that, and it does display the asterisk when the document has unsaved changes, but not the "- Edited" like TextEdit or Script Editor does. Both of these apps display the "- Edited" instead of the little dot on the close button. Is this something Qt has control over?

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

          Qt handles this on several levels however from a quick look at the code, it's QWidget's implementation that handles the title changes.

          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
          1
          • P Offline
            P Offline
            patrcki
            wrote on last edited by
            #5

            I cannot get the "- Edited" label to appear either.

            Looking at the code, QCocoaWindow::setWindowModified is calling [NSWindow setDocumentEdited:YES] (https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/#//apple_ref/occ/instp/NSWindow/documentEdited). Is there anything else Qt is doing that might prevent this from working?

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

              See the windowModified property

              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
              2

              • Login

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