Results 1 to 3 of 3

Thread: QMainWindow::addToolbar/removeToolbar

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Mar 2006
    Posts
    10
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMainWindow::addToolbar/removeToolbar

    I have used to create a toolbar
    Qt Code:
    1. 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
    Qt Code:
    1. void MainWindow::on_pushButton_1_clicked()
    2. {
    3. if (ui->pushButton_1->isChecked()) {
    4. this->addToolBar(t1);
    5. t1->show();
    6. }
    7. else
    8. this->removeToolBar(t1);
    9. }
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to Rembobo for this useful post:

    psih128 (18th November 2009)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.