[Uml-devel] kdesdk/umbrello/umbrello/dialogs

Sebastian Stein seb.kde at hpfsc.de
Fri Jul 30 08:08:19 UTC 2004


CVS commit by sstein: 

fix bug 72801: This one was a little bit ugly, because you can not deselect the items in the list box, if there are still items left. A call to clearSelection() in such a case results in selecting the first item. I think that's not good behaviour, but it is a Qt issue and it is documented in Qt docs for function QListBox::clearSelection().

Now, after adding a new item (attr, ...), this item will be selected so that the user can go on working with this new item.

modified functions:
	void ClassifierListPage::slotListItemCreated(UMLObject* object)
	void ClassifierListPage::slotClicked(QListBoxItem*item)


  M +18 -5     classifierlistpage.cpp   1.14


--- kdesdk/umbrello/umbrello/dialogs/classifierlistpage.cpp  #1.13:1.14
@@ -167,14 +167,23 @@ void ClassifierListPage::slotClicked(QLi
         }
 
-        //make sure clicked on an item
-        if(!item) {
+        // make sure clicked on an item
+        // it is impossible to deselect all items, because our list box has keyboard
+        // focus and so at least one item is always selected; this doesn't happen, if
+        // there are no items of course;
+        //
+        // for more information see Qt doc for void QListBox::clearSelection()
+        UMLClassifierListItem* listItem;
+        if(!item && m_pItemListLB->count() == 0) {
                 enableWidgets(false);
                 m_pOldListItem = 0;
                 m_pItemListLB->clearSelection();
                 return;
+        } else if (!item && m_pItemListLB->count() > 0) {
+                m_pItemListLB->setSelected(0, true);
+                listItem = getItemList().at(0);
+        } else {
+                listItem = getItemList().at( m_pItemListLB->index(item) );
         }
 
-        UMLClassifierListItem* listItem = getItemList().at( m_pItemListLB->index(item) );
-
         //now update screen
         m_pDocTE->setText( listItem->getDoc() );
@@ -205,5 +214,9 @@ void ClassifierListPage::slotListItemCre
         m_pItemListLB ->insertItem((static_cast<UMLClassifierListItem*>(object))->getShortName(), index);
         m_bSigWaiting = false;
-        slotClicked(0);
+
+        // now select the new item, so that the user can go on adding doc or calling
+        // the property dialog
+        m_pItemListLB->setSelected(index, true);
+        slotClicked(m_pItemListLB->item(index));
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////






More information about the umbrello-devel mailing list