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. QDialog with fixed size
Qt 6.11 is out! See what's new in the release blog

QDialog with fixed size

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 2.0k 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.
  • gde23G Offline
    gde23G Offline
    gde23
    wrote on last edited by
    #1

    Hello,

    I've come upon this problem several times:
    I have a class that inherits from QDialog and I just want to make it lets say 500x500 pixels in size, no matter on if the widgets on it need that space or not.

    I've tried:

    • dialog->setFixedSIze();
    • dialog->window()-setFixedSize();
    • Reimplementing sizeHint() and minimumSizeHint()
    • window()->layout()->setSizeConstraint( QLayout::SetFixedSize ); then resize or rezise and then set contraints

    nothing works, so what am I missing?

    What I used as work around some times it so resize the widgets in the dialog to push it out, but that cannot be the right method.

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

      Hi,

      Can you post a minimal compilable sample code that shows the behaviour ?

      Which version of Qt are you using ?
      On which platform ?

      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
      2
      • gde23G Offline
        gde23G Offline
        gde23
        wrote on last edited by
        #3

        Setting up the minimal example brought me to the solution :)

        I had

        main_layout->setSizeConstraint(QLayout::SetFixedSize);
        

        in the constructor from copy pasting from another dialog.
        Removing it fixed it.

        Thanks

        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