Important: Please read the Qt Code of Conduct -

qwidget resize function

  • hello,
    Let's say i resize a widget to(700,700) and it's inside a widget that is inside a scroll area why is the size that is set not independant of the screen? on a smaller screen it will set a smaller height...
    How can I make it independent?

  • Lifetime Qt Champion


    How did you put that widget inside that other widget inside that scroll area ?

  • @SGaist there is a widget that is the main widget of the mainwindow(called widgettest) inside it there is 5 subwidgets each having a subSubwidget insde them
    I tam trying to resize the subSub widgets

    scroll = new QScrollArea(this);// seting Main Window as the parent of the widget that contains evrithing                       
    this->setCentralWidget(scroll);// setiing that widget as the central widget;
    scroll->setWidget(ui->widgettest);// widget test is the random widget that contains evrithing
    scroll->setWidgetResizable(true);// this makes the iwdgets as big as possible

    but my question when you resize a widget is with resize(int w, int h) is w and h in pixels? or something else? is the reize independent of the screnn? if I do subsubwidget->resize(500,500); it's always gonna be 500 pixels by 500?

    also main window applys a layout to the widgettest and idget test applys a layout to the subwidgets and the subsubwidgets have a layout inside the sub widgets wich delete at run time to resize..

    thank you

  • Lifetime Qt Champion

    It's in pixel.

    QMainWindow doesn't apply any particular layout. It will resize the central widget if you resize the window.

    If you want to handle the size of your sub-sub widget by hand, you should not put it in a layout otherwise it's the layout manager that will manage the size and position of it.

  • @SGaist yes but the thing is that I delete the layout of the sub widget of the subsubwidget and then reaply it after I resize the subsubwidget you think I should not reaplly it? the ting is my subwidget has a minimum size of 1000 pixels I dont understand why on a smaller sccreen it does not take that minimum size and shrinks to 800..

  • Lifetime Qt Champion

    just a thought
    did u call setMinimumH/W on the widget?

Log in to reply