I have used to create a toolbar
t1 = addToolBar("Toolbar 1"); //new QToolBar("Toolbar 1", this);
t1 = addToolBar("Toolbar 1"); //new QToolBar("Toolbar 1", this);
To copy to clipboard, switch view to plain text mode
If I use "new QToolBar("Toolbar 1", this)" the toolbars are created/placed badly (imho).
A toolbar is not just removed but also hidden. So after readding it to main window show it (make it visible).
Like
void MainWindow::on_pushButton_1_clicked()
{
if (ui->pushButton_1->isChecked()) {
this->addToolBar(t1);
t1->show();
}
else
this->removeToolBar(t1);
}
void MainWindow::on_pushButton_1_clicked()
{
if (ui->pushButton_1->isChecked()) {
this->addToolBar(t1);
t1->show();
}
else
this->removeToolBar(t1);
}
To copy to clipboard, switch view to plain text mode
Bookmarks