#include class MyMainWindow : public QMainWindow { public: MyMainWindow(QWidget *parent = 0) : QMainWindow(parent) { this->setGeometry(300, 300, 400, 400); QWidget* mainWidget = new QWidget(this); mainWidget->setGeometry(50, 50, 300, 300); QGridLayout* mainLay = new QGridLayout; mainLay->setSpacing(0); mainLay->setMargin(0); QPushButton* button01 = new QPushButton("Buton01"); //button01->setFixedSize(100, 50); /* setting fixed size on this button makes other to be drawn as intended (overlapping each other). when at least one object in the layout doesn't have fixed size set, it seems that fixed size on other objects is ignored. This applicable for Mac OS. Works as expected on Windows XP */ QHBoxLayout *hL = new QHBoxLayout; hL->addWidget(button01); mainLay->addLayout(hL, 0, 0); QHBoxLayout *hL2 = new QHBoxLayout; QPushButton* button1 = new QPushButton("Buton1"); button1->setFixedSize(250, 150); hL2->addWidget(button1); QPushButton* button2 = new QPushButton("Button2"); button2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); button2->setFixedSize(250, 150); hL2->addWidget(button2); mainLay->addLayout(hL2, 1,0,1,2); mainWidget->setLayout(mainLay); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); MyMainWindow w; w.show(); return a.exec(); }