Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

When resize the position is not changing



  • In QT creator, we are designing the UI. Here, 1 push button, horizontal spacer and 1 label. All are in Horizontal Layout.

    We do not want the vertical sizes of the above items to full app window. So we fixed the vertical size to 70.

    When resize the last label is in same position before the resize.
    Push button, properties are: Horizontal policy: Expanding and Vertical: Fixed.
    Horizontal spacer: size Type: Expanding
    Label, properties are: Horizontal policy: Expanding and Vertical: Fixed.

    When resize, the label is not going to end of the app window. It is in same position. What is the reason for this??

    The App window image is:
    0_1534170637570_resize_problem1.png


  • Moderators

    @Balaji-N most likely it‘s the text alignment of the lable,

    By default its horizontal left and vertical center

    the following solution come to my mind:

    • You could set the horizontal property of the label to prefered, than it should resize to its content width,
    • you could apply a strech factor to each item in the layout
    • you could set the text align to horizontal right an vertical center

Log in to reply