I have created a main window with two toolbars on the same row. Each toolbar has three buttons on it. However, I would like to have the first toolbar take up all the available space while let the 2nd one stay at minimum. I am trying to do this via sizing policy. I basically took the SDI example from QtDemo and modified the code in void MainWindow::createToolBars() as shown below:

void MainWindow::createToolBars()
{
fileToolBar = addToolBar(tr("File"));
fileToolBar->addAction(newAct);
fileToolBar->addAction(openAct);
fileToolBar->addAction(saveAct);
fileToolBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy: :Minimum);

editToolBar = addToolBar(tr("Edit"));
editToolBar->addAction(cutAct);
editToolBar->addAction(copyAct);
editToolBar->addAction(pasteAct);
fileToolBar->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::M inimum);
}

However, it has no effect at all. QT always let the last toolbar on the same row takes up all the available space.

Any idea what I did wrong? Thanks for any tips.