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

i cannot add a layout to my widget



  • Hello, i'm working on a QDialog and i cannot manage to add a layout to my QWidget. heres a related screenshot : Capture.JPG

    for example when i try to select the tab5 QWidget and try to add a layout vertically, the whole Dialog goes vertical and messes everything up, and the selection goes back to QDialog, which i dont understand why. does anyone know how to solve this ?

    ( i am having a really hard time understanding this layout situation..)



  • @aftalib said in i cannot add a layout to my widget:

    ( i am having a really hard time understanding this layout situation..)

    I agree! Qt Designer has the really confusing "feature" that you cannot add a layout to any widget unless you add a child widget to it first :( Then you can set the widget's layout. Apparently you can then even delete the child widget and the parent will retain its layout.

    Note that the above applies to setting layout on a widget, which is why your tabs show with the "red no-entry sign" on them, to show they have no layout. I'm not sure how this relates if you are saying you are trying to drag an explicit layout onto a widget, which maybe is what you are saying. But see if what I have written helps.



  • That part is a little bit confusing. Your QTabWidget will have a currently visible tab. To set the layout of the currently visible tab, you set the layout on tabWidget_2. Switch to the other tabs to set their layouts by also applying the layout to tabWidget_2 again.


Log in to reply