Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-96632

Storing window geometry using Settings does not work correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15
    • None

    Description

      https://stackoverflow.com/questions/31426528/saving-window-state-with-qml explains it, so I'll just quote part of that here:

      The documentation gives the following method:

      	Settings {
      		property alias x: mainWindow.x
      		property alias y: mainWindow.y
      		property alias width: mainWindow.width
      		property alias height: mainWindow.height
      

      However that has three flaws:

      1. It writes to the settings file continuously when you resize / move the window.
      2. It doesn't remember whether the window is maximised or not (Notepad++ also suffers from this annoying flaw btw).
      3. If you maximise the window it doesn't save the unmaximised geometry.

      We should make this work out of the box, or provide a convenience type if that's not possible. It shouldn't be necessary to resort to such lengthy workarounds just to save a window's state.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mitch_curtis Mitch Curtis
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes