Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Best practice to save and restore QML ApplicationWindow state and geometry

Best practice to save and restore QML ApplicationWindow state and geometry

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 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.
  • U Offline
    U Offline
    Uwe Koehler
    wrote on last edited by
    #1

    Hi folks,

    hope you can help me out. There is a best practice documentation for QWidget to save and restore window geometry and status: link. I tested that extensively and it works really great. I even detached a second monitor on Windows and it worked as expected.

    What would be the best practice for QML ApplicationWindow. I could not find any top level class that would derive from QWidget and provide those functions.

    Cheers

    Uwe

    benlauB 1 Reply Last reply
    0
    • U Uwe Koehler

      Hi folks,

      hope you can help me out. There is a best practice documentation for QWidget to save and restore window geometry and status: link. I tested that extensively and it works really great. I even detached a second monitor on Windows and it worked as expected.

      What would be the best practice for QML ApplicationWindow. I could not find any top level class that would derive from QWidget and provide those functions.

      Cheers

      Uwe

      benlauB Offline
      benlauB Offline
      benlau
      Qt Champions 2016
      wrote on last edited by
      #2

      @Uwe-Koehler I am using Settings component from Qt.labs.settings

          Settings {
              id: mainSettings
              property alias x: mainWindow.x
              property alias y: mainWindow.y
              property alias width: mainWindow.width
              property alias height: mainWindow.height
          }
      

      Example Code in real project:
      https://github.com/benlau/sparkqml/blob/master/app/sparkqml/main.qml#L26

      U 1 Reply Last reply
      1
      • benlauB benlau

        @Uwe-Koehler I am using Settings component from Qt.labs.settings

            Settings {
                id: mainSettings
                property alias x: mainWindow.x
                property alias y: mainWindow.y
                property alias width: mainWindow.width
                property alias height: mainWindow.height
            }
        

        Example Code in real project:
        https://github.com/benlau/sparkqml/blob/master/app/sparkqml/main.qml#L26

        U Offline
        U Offline
        Uwe Koehler
        wrote on last edited by
        #3

        @benlau Many thanks for the reply. I did play around with that and it does work for "normal" operation. The QWidget code covers all the "non-normal" cases, as well. I wanted to avoid to re-implement all that.

        Cheers

        Uwe

        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