qt-bugs@ issue : N26525 applied: no author: Thomas Zander it is possible to remove all tabs from a QTabWidget in the 'object explorer'. After inserting a new tabWidget I normally get 2 tabs. Using the popup menu on the widget itself a delete is not present when there is just one tab left. In other words; I can't delete all tabs. The popup menu presented on the 'object explorer' toolbar does not do any checking on the amount of tabs present; it is possible to delete all tabs from there. To reproduce; - Open new document. - Insert QTabWidget. - Press with RMB on the just inserted tabWidget and press 'delete page' - Open the same popup again; notice the missing 'delete page' entry. - go to the 'object explorer' toolbar and make sure it is on the 'objects' tab. - Press with the RMB on the QTabWidget name. - Press 'delete page' and the last page is deleted. Solution; on every show of the popup check if delete is possible and enable correctly. Index: tools/designer/designer/hierarchyview.cpp =================================================================== RCS file: /home/kde/qt-copy/tools/tools/designer/designer/hierarchyview.cpp,v retrieving revision 1.20 diff -u -3 -p -b -r1.20 hierarchyview.cpp --- work/qt-x11-free-3.3.8/tools/designer/designer/hierarchyview.cpp 23 Jun 2003 11:49:05 -0000 1.20 +++ work/qt-x11-free-3.3.8/tools/designer/designer/hierarchyview.cpp 12 Jul 2003 17:09:29 -0000 @@ -599,6 +599,7 @@ void HierarchyList::showRMBMenu( QListVi formWindow->mainWindow()->setupTabWidgetHierarchyMenu( this, SLOT( addTabPage() ), SLOT( removeTabPage() ) ); + tabWidgetMenu->setItemEnabled(MainWindow::POPUP_REMOVE_PAGE_ID, ((QDesignerTabWidget*)w )->count() > 1); tabWidgetMenu->popup( p ); } } Index: tools/designer/designer/mainwindow.cpp =================================================================== RCS file: /home/kde/qt-copy/tools/tools/designer/designer/mainwindow.cpp,v retrieving revision 1.33 diff -u -3 -p -b -r1.33 mainwindow.cpp --- work/qt-x11-free-3.3.8/tools/designer/designer/mainwindow.cpp 23 Jun 2003 11:49:06 -0000 1.33 +++ work/qt-x11-free-3.3.8/tools/designer/designer/mainwindow.cpp 12 Jul 2003 17:09:31 -0000 @@ -2419,8 +2419,8 @@ QPopupMenu *MainWindow::setupTabWidgetHi { QPopupMenu *menu = new QPopupMenu( parent ); - menu->insertItem( tr( "Add Page" ), parent, addSlot ); - menu->insertItem( tr( "Delete Page" ), parent, removeSlot ); + menu->insertItem( tr( "Add Page" ), parent, addSlot, 0, POPUP_REMOVE_PAGE_ID+1 ); + menu->insertItem( tr( "Delete Page" ), parent, removeSlot, 0, POPUP_REMOVE_PAGE_ID ); menu->insertSeparator(); actionEditCut->addTo( menu ); actionEditCopy->addTo( menu ); Index: tools/designer/designer/mainwindow.h =================================================================== RCS file: /home/kde/qt-copy/tools/tools/designer/designer/mainwindow.h,v retrieving revision 1.15 diff -u -3 -p -b -r1.15 mainwindow.h --- work/qt-x11-free-3.3.8/tools/designer/designer/mainwindow.h 16 May 2003 13:03:27 -0000 1.15 +++ work/qt-x11-free-3.3.8/tools/designer/designer/mainwindow.h 12 Jul 2003 17:09:31 -0000 @@ -107,6 +107,7 @@ public: QPopupMenu *setupNormalHierarchyMenu( QWidget *parent ); QPopupMenu *setupTabWidgetHierarchyMenu( QWidget *parent, const char *addSlot, const char *removeSlot ); + static const int POPUP_REMOVE_PAGE_ID = 1; FormWindow *openFormWindow( const QString &fn, bool validFileName = TRUE, FormFile *ff = 0 ); bool isCustomWidgetUsed( MetaDataBase::CustomWidget *w );