#include class Widget: public QWidget { public: Widget(QWidget *parent = 0) : QWidget(parent) { QVBoxLayout *vbox = new QVBoxLayout(this); vbox->addWidget(new QSpinBox); vbox->addWidget(new QDoubleSpinBox); // With this stylesheet, the height computation for the spinbox // is wrong (even if the stylesheet has nothing to do with // the spinbox, as you can see. setStyleSheet(" "); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); Widget w; w.show(); return a.exec(); }