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
Forum Updated to NodeBB v4.3 + New Features

QDialog with fixed size

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.3k 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.
  • G Offline
    G Offline
    gde23
    wrote on 11 Aug 2022, 18:09 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 11 Aug 2022, 18:15 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
      • G Offline
        G Offline
        gde23
        wrote on 11 Aug 2022, 18:24 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

        1/3

        11 Aug 2022, 18:09

        • 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