Important: Please read the Qt Code of Conduct -

Subclassed QWidget not respecting ColumnSpan

  • Hello,
    I have a Custom Widget (subclass of QWidget) that holds a GroupBox, a slider and an QSpinBox. I have a grid layout in my dock widget's main widget.

    If I add a button to the to the main layout l->addWidget(w,0,0,1,5) the button seems correctly stretched (columnspan of 5)

    If I add my custom widget, it always is taking up approx 2 columns -

    l->addWidget(1,0,1,5) // does not expand to 5 columns
    l_addWidget(1,0,1,2) // same size as above

    So my widget is not obeying the column span.

    I must be not setting a sizeHint() ?? Or a window flag?

    Not sure what the problem is. Any tips welcome?



  • Lifetime Qt Champion


    Can you show your complete code ?

    What version of Qt are you using ?
    On what platform ?

Log in to reply