Search code examples
c++qtqwidget

Derived widget inside a layout


I have an object derived from QWidget. If I say object->show() it works perfectly, but I want to insert that object into a gridLayout of another class, also derived from QWidget. I've tried to add it with addWidget(*widget) like a regular pushButton (for ex) would work.


Solution

  • I'll take a wild guess: Check the sizePolicy() and sizeHint() of your widget. It might be that your widget is inside the layout, but resized to 0x0.

    Try to setMinimumSize(); your widget might then appear if my guess is right.