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 preserve QDialog widget size after hide/show

How to preserve QDialog widget size after hide/show

Scheduled Pinned Locked Moved Unsolved General and Desktop
qdialog
3 Posts 3 Posters 642 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.
  • R Offline
    R Offline
    RedSoft
    wrote on last edited by
    #1

    I have custom QDialog subclass which I want won't change its geometry and position after each hide + show call. Currently the position is preserved but the size is reset to its initial size, despite user previously resized it. I know it can be done using getting current geometry and then restoring it by setGeometry, but is it possible to set some flag in order to do it automatically?

    JonBJ Christian EhrlicherC 2 Replies Last reply
    0
    • R RedSoft

      I have custom QDialog subclass which I want won't change its geometry and position after each hide + show call. Currently the position is preserved but the size is reset to its initial size, despite user previously resized it. I know it can be done using getting current geometry and then restoring it by setGeometry, but is it possible to set some flag in order to do it automatically?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @RedSoft
      There is no magic flag if you say it's not being preserved. (I thought it would remember both, but if you say it restores position but not size fair enough.) Use setGeometry() or similar to restore if you find you need to.

      1 Reply Last reply
      0
      • R RedSoft

        I have custom QDialog subclass which I want won't change its geometry and position after each hide + show call. Currently the position is preserved but the size is reset to its initial size, despite user previously resized it. I know it can be done using getting current geometry and then restoring it by setGeometry, but is it possible to set some flag in order to do it automatically?

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @RedSoft said in How to preserve QDialog widget size after hide/show:

        but the size is reset to its initial size, despite user previously resized it.

        And you're sure you don't have a resize() somewhere? Please check with an empty class derived from QDialog - the size will not change for sure.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        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