You can use QToolBar::orientation
property:
ui->myToolbar->setOrientation(Qt::Vertical);
You can also use QMainWindow::addToolBar
:
addToolBar(Qt::LeftToolBarArea, ui->myToolbar);
Note that by default the user is able to drag toolbars and attach them to any side of the main window.