PDA

View Full Version : [QtDesigner] Multiple rows of QToolBar



Malutek
13th January 2013, 01:38
Hello,

I've been struggling for quite some time with this problem, and unfortunately Google failed to help me find a solution.
I want to design a window with multiple QToolBars on top of the window. These QToolBars (currently have 5 of them) are supposed to be in 2 rows. The problem is that in QtDesigner it looks good, I have them grouped into 2 rows, but when I compile it, it all messes up. It put last 4 toolbars in second row, and only first toolbar is in first row. I've been reading about using:

QMainWindow::addToolBarBreak ( Qt::ToolBarArea area = Qt::TopToolBarArea );
but the problem is that I'm using QtDesigner, so I can't really use that (or is there some kind of functionality in QtDesigner like 'Cutomize Code' similiar to what's implemented in Netbeans?). Thanks in advance for your help, and sorry for me average English, still learning.

d_stranz
13th January 2013, 22:45
In your Designer file, you have given each toolbar a unique name, haven't you? In your main window constructor, after you have called setupUi(), call



QToolBar * firstBarSecondLine = ui->whateverTheToolbarIsNamed;
insertToolbarBreak( firstBarSecondLine );


This should insert a line break before the firstBarSecondLine tool bar.

There is probably a way to do this in .ui file code (maybe not interactively using the Designer), but I don't know how.

Malutek
19th January 2013, 16:23
That was exactly what I was looking for. Thank you very much d_stranz!