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. Is there a "Window dirty" UI indicator?
QtWS25 Last Chance

Is there a "Window dirty" UI indicator?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 976 Views
  • 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.
  • D Offline
    D Offline
    davecotter
    wrote on last edited by davecotter
    #1

    On the mac, you can call SetWindowModified() to set a window's "dirty" bit, causig the red "close button" to get a dark dot in it, indicating "changed but not saved".

    Is there an API for that in Qt that works cross platform?

    Pl45m4P 1 Reply Last reply
    0
    • D Offline
      D Offline
      davecotter
      wrote on last edited by
      #6

      oh. i see. adding "[*]" to window title does not actually show up in the UI. well that's confusing. setWindowModified() should add that for you behind the scenes if necessary, the client shouldn't have to know about it. but okay, that works, thanks.

      1 Reply Last reply
      0
      • D davecotter

        On the mac, you can call SetWindowModified() to set a window's "dirty" bit, causig the red "close button" to get a dark dot in it, indicating "changed but not saved".

        Is there an API for that in Qt that works cross platform?

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by Pl45m4
        #2

        @davecotter

        https://stackoverflow.com/questions/31859008/qt-osx-system-window-close-button-state

        Haven't tried it out, but according to this, it will work at least on Windows as well (Showing a " * " when file or window is modified).

        Edit:
        The " * " should appear even on Linux platforms.
        QWidget Modified Window


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply
        5
        • MasterBLBM Offline
          MasterBLBM Offline
          MasterBLB
          wrote on last edited by MasterBLB
          #3

          You need to add placeholder "[*]" to window title, say by setWindowTitle(windowTitle() + "[*]");, then call setWindowModified()

          D 1 Reply Last reply
          3
          • MasterBLBM MasterBLB

            You need to add placeholder "[*]" to window title, say by setWindowTitle(windowTitle() + "[*]");, then call setWindowModified()

            D Offline
            D Offline
            davecotter
            wrote on last edited by
            #4

            @Pl45m4 callig setWindowModified(true) does nothing on windows

            @MasterBLB what is the point of calling setWindowModified() on windows if it does nothing? IOW: if i'm going to have to manually manage whether the asterisk is shown, why bother calling that?

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

              Hi,

              As explained in the property documentation, the "[*]" placeholder is to be put in the title so it will appear at that position when you call setWindowModified(true).

              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
              • D Offline
                D Offline
                davecotter
                wrote on last edited by
                #6

                oh. i see. adding "[*]" to window title does not actually show up in the UI. well that's confusing. setWindowModified() should add that for you behind the scenes if necessary, the client shouldn't have to know about it. but okay, that works, thanks.

                1 Reply Last reply
                0
                • D davecotter

                  @Pl45m4 callig setWindowModified(true) does nothing on windows

                  @MasterBLB what is the point of calling setWindowModified() on windows if it does nothing? IOW: if i'm going to have to manually manage whether the asterisk is shown, why bother calling that?

                  MasterBLBM Offline
                  MasterBLBM Offline
                  MasterBLB
                  wrote on last edited by MasterBLB
                  #7

                  @davecotter said in Is there a "Window dirty" UI indicator?:

                  @MasterBLB what is the point of calling setWindowModified() on windows if it does nothing? IOW: if i'm going to have to manually manage whether the asterisk is shown, why bother calling that?

                  It does something - it sets internal flag windowModified. What you'll do with that flag it's up to you.

                  @davecotter said in Is there a "Window dirty" UI indicator?:

                  setWindowModified() should add that for you behind the scenes if necessary, the client shouldn't have to know about it.

                  Nope, it shouldn't - imagine someone wishes the flag state to be changed, but not window title. Besides, in QWidget documentation about windowTitle member you have explicitly mentioned how it works, and that placeholder may be added to window title.

                  1 Reply Last reply
                  5

                  • Login

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