PDA

View Full Version : How to restrict autodelete in Qt?



vql
23rd March 2008, 12:24
I am developing a program have the interface same as Office 2007.
I need use many toolbars but only one toolbar display on main window.
When user click on menu File -> I show toolbar fileToolBar
When user click on menu Edit -> I show toolbar editToolBar



mainWin->setToolBar(fileToolBar); // user select menu File
//...
mainWin->setToolBar(editToolBar); // user select menu Edit -> fileToolBar will be deleted
//...
mainWin->setToolBar(fileToolBar); // user reselect menu File but in this case, program will cause error because fileToolBar deleted.


Please help me how to solve this problem.

wysota
23rd March 2008, 12:28
What does autodelete have to do with what you are doing? Unless you explicitely delete the parent (or higher ancestor) of the toolbar it won't get deleted, hidden at most.