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
QtWS25 Last Chance

How to preserve QDialog widget size after hide/show

Scheduled Pinned Locked Moved Unsolved General and Desktop
qdialog
3 Posts 3 Posters 638 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 21 Nov 2021, 11:36 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?

    J C 2 Replies Last reply 21 Nov 2021, 11:51
    0
    • R RedSoft
      21 Nov 2021, 11:36

      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?

      J Offline
      J Offline
      JonB
      wrote on 21 Nov 2021, 11:51 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
        21 Nov 2021, 11:36

        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?

        C Online
        C Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on 21 Nov 2021, 12:43 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

        1/3

        21 Nov 2021, 11:36

        • Login

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