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. [Solved] How to block vertical size of a QWidget on Windows.

[Solved] How to block vertical size of a QWidget on Windows.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 1.8k 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.
  • A Offline
    A Offline
    Athius
    wrote on last edited by
    #1

    Hi everyone,

    I made a QWidget and I'd like to block the vertical size.

    I tried many things like:
    @setMinimumSize(200, 40);
    setMaximumSize(500, 40);
    resize(200,40);@

    But nothing work correctly: I can always "resize" vertically the widget. I also tried to add a layout and fixed the size but I have the same result.

    What did I do wrong?

    For information, I use Qt 5.1.1.

    Thank you.

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

      Hi,

      Is "setFixedHeight":http://qt-project.org/doc/qt-5/qwidget.html#setFixedHeight what you are looking for ?

      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
      0
      • A Offline
        A Offline
        Athius
        wrote on last edited by
        #3

        I tried this too but it doesn't work.

        1 Reply Last reply
        0
        • JeroentjehomeJ Offline
          JeroentjehomeJ Offline
          Jeroentjehome
          wrote on last edited by
          #4

          Did you set the sizePolicy to fixed?
          And also set the sizeHint value?

          Greetz, Jeroen

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Athius
            wrote on last edited by
            #5

            I tried too but no success...
            @
            setMinimumSize(200, 40);
            setMaximumSize(500, 40);
            setFixedHeight(40);
            setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
            @

            In the documentation, I read this about minimumSizeHint:
            @If minimumSize() is set, the minimum size hint will be ignored.@

            So I didn't overwrite it yet.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Athius
              wrote on last edited by
              #6

              I just figure that maybe my components inside my widget are bigger than my minimum height... so my problem is quite normal, isn't it?

              Edit: I change the minimum size of my widget, and every thing work now!

              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