Important: Please read the Qt Code of Conduct -

How to change the width of QDialogbox with the click of a button

  • 3c1776fa-50a3-4e02-945f-330f19e1db9d-image.png

    This is my QDialog
    as of now the width of the QDialog is 1000, on right side the QListwidget covers 500 width, when i click the button "Show/Hide" , i should be able to change the width of QDialog frm 1000 to 500 (such that i am able to hide the QListwidget) and vice versa,

    i guess i would have to use setFixedWidth(int w) function, but kinda confused how would i do it to change the QDialog size

  • @Mr-Workalot

    First of all, it seems that you don't use any layouts.
    Secondly, don't hide your widget by just resizing your dialog (if you are trying to do that). Better hide the widget itself.

    To set a width anyway, you can use
    QWidget::resize(int w, int h)

Log in to reply