How to adjust widgets automatically to screen resolutions

  • Hi all

    I am very newbie to Qt. I have developed a Qt GUI aplication for Desktops. In my application i have used some buttons and textboxes.
    The problem is that when i deploy it on machine of different resolution the Widgets are going here and there. I dontwant to create widgets through code , i just want to drag from menu and use it .

    Plz tell me how i can make them autoadjustable to diffrent screen resolution.

    Thans in advnce

  • Take a look at "Layout Management":
    and at "Using Layouts in Qt Designer":http://

  • Hi Extensa
    thank u very much for valuable advice. I wnt through th document and was able to create the resulution free GUI but one bigger issue is that i am not able to change the widget property like position, size,color because lauout manager is not allowing that.

    please tll me how to cahnge these properties of widgets.

    Thanking u in advance

  • bq. All QWidget subclasses can use layouts to manage their children. The QWidget::setLayout() function applies a layout to a widget. When a layout is set on a widget in this way, it takes charge of the following tasks:

    • Positioning of child widgets.
    • Sensible default sizes for windows.
    • Sensible minimum sizes for windows.
    • Resize handling.
    • Automatic updates when contents change:
    • Font size, text or other contents of child widgets.
    • Hiding or showing a child widget.
    • Removal of child widgets.

    So, you can let Layout Manger do that, or you should override events of your main widget and change needed properties dynamically... Like "resizeEvent": If you can show us an example of what you are doing and how the properties should be changed, maybe you will get more exact advice...

  • Hi,
    There are 4 ready-made layouts : QVBoxLayout, QHBoxLayout, QGridLayout and QFormLayout. All of them inherit QLayout.
    If any of them doesn't fit your application you can subclass QLayout and create a custom layout :)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.