Qt アプリのメイン ウィンドウ ウィジェットの ctor に次のコードがあります。QGridLayout に追加されたボタンをどのように配置しても、ボタンは常に左上隅に重なって表示されます。
私が間違ったことを誰か教えてもらえますか、見つけられません。
btn_File= new QPushButton("&File", this);
btn_Close = new QPushButton("&Close", this);
btn_File->setAutoFillBackground(true);
btn_Close->setAutoFillBackground(true);
QGridLayout * layout = new QGridLayout(this);
layout->setContentsMargins(20,20,10,10);
layout->setSpacing(5);
layout->addWidget(btn_File,2,2, Qt::AlignRight);
layout->addWidget(btn_Close,1,1);
this->setLayout(layout);
編集: だけbtn_Close
が描かれているようです。QComboBox をグリッドに追加しようとしましたが、表示されません。