void ToolBarAreaImpl::layoutToolBarRow(ToolBarRowPtr toolBarRow, int& io_rowTop, bool isNewBottomRow) { int rowHeight = 0; bool draggedToolBarExists = false; ToolBarList& toolBars = toolBarRow->toolBars; // calculate the row height and remove the dragged tool bar if it is originally in this row ToolBarList::iterator p = toolBars.begin(); while(p != toolBars.end()){ ToolBar* toolBar = *p; if(toolBar == draggedToolBar){ draggedToolBarExists = true; p = toolBars.erase(p); } else { rowHeight = std::max(rowHeight, toolBar->sizeHint().height()); ++p; } } // Is the dragged tool bar moving to this row ? bool isDraggedToolBarMovingToThisRow = false; if(draggedToolBarHasNotBeenInserted){ int bottomBorder = 0; if(rowHeight == 0 && draggedToolBarExists){ int h = draggedToolBar->sizeHint().height(); bottomBorder = io_rowTop + h * 4 / 5; } else { bottomBorder = io_rowTop + rowHeight; } if(dragY < bottomBorder || isNewBottomRow){ isDraggedToolBarMovingToThisRow = true; rowHeight = std::max(rowHeight, draggedToolBar->sizeHint().height()); layoutToolBarRowWithDraggedToolBar(toolBars, io_rowTop, rowHeight); } } if(toolBars.empty()){ toolBarRow->separator.hide(); } else { if(!isDraggedToolBarMovingToThisRow){ layoutToolBarRowPart(toolBars, io_rowTop, rowHeight, 0, self->width()); } for(ToolBarList::iterator p = toolBars.begin(); p != toolBars.end(); ++p){ ToolBar* toolBar = *p; if(toolBar->height() != rowHeight){ toolBar->setGeometry(toolBar->x(), io_rowTop, toolBar->width(), rowHeight); } } io_rowTop += rowHeight; HSeparator& sep = toolBarRow->separator; int h = sep.sizeHint().height(); sep.setGeometry(0, io_rowTop, self->width(), h); sep.show(); io_rowTop += sep.sizeHint().height(); } }