[Uml-devel] KDE/kdesdk/umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Sun Jun 27 22:12:59 UTC 2010
SVN commit 1143485 by fischer:
Clicking on close tab is now realy closing the diagram and not deleting it. Tool tip on diagram tabs added to better identify the diagram when a lot of diagrams are open.
M +20 -11 uml.cpp
M +3 -2 uml.h
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.cpp #1143484:1143485
@@ -658,7 +658,7 @@
m_tabWidget = new KTabWidget(this);
m_tabWidget->setAutomaticResizeTabs(true);
m_tabWidget->setTabsClosable(true);
- connect(m_tabWidget, SIGNAL(closeRequest(QWidget*)), SLOT(slotDeleteDiagram(QWidget*)));
+ connect(m_tabWidget, SIGNAL(closeRequest(QWidget*)), SLOT(slotCloseDiagram(QWidget*)));
m_newSessionButton = new QToolButton(m_tabWidget);
m_newSessionButton->setIcon(Icon_Utils::SmallIcon(Icon_Utils::it_Tab_New));
@@ -1627,7 +1627,9 @@
foreach (UMLView *view, views) {
m_viewStack->removeWidget(view);
m_tabWidget->addTab(view, view->getName());
- m_tabWidget->setTabIcon(m_tabWidget->indexOf(view), Icon_Utils::iconSet(view->getType()));
+ int tabIndex = m_tabWidget->indexOf(view);
+ m_tabWidget->setTabIcon(tabIndex, Icon_Utils::iconSet(view->getType()));
+ m_tabWidget->setTabToolTip(tabIndex, view->getName());
}
m_layout->addWidget(m_tabWidget);
m_tabWidget->show();
@@ -2350,20 +2352,25 @@
}
/**
- * Deletes the current diagram.
- * @param tab Widget's tab to close
+ * Deletes the current diagram. Called from menu action.
*/
-void UMLApp::slotDeleteDiagram(QWidget* tab)
+void UMLApp::slotDeleteDiagram()
{
- if (tab == NULL) { // called from menu action
m_doc->removeDiagram( getCurrentView()->getID() );
}
- else { // clicked on close button
+
+/**
+ * Close the current diagram. Clicked on tab close button.
+ * @param tab Widget's tab to close
+ */
+void UMLApp::slotCloseDiagram(QWidget* tab)
+{
+ if (tab) {
UMLView* view = (UMLView*)tab;
if (view != getCurrentView()) {
setCurrentView(view);
}
- m_doc->removeDiagram( view->getID() );
+ m_tabWidget->removeTab(m_tabWidget->indexOf(view));
}
}
@@ -2542,11 +2549,13 @@
Settings::OptionState optionState = Settings::getOptionState();
if (optionState.generalState.tabdiagrams) {
- if ( m_tabWidget->indexOf(view) < 0 ) {
+ int tabIndex = m_tabWidget->indexOf(view);
+ if (tabIndex < 0) {
m_tabWidget->addTab(view, view->getName());
- m_tabWidget->setTabIcon(m_tabWidget->indexOf(view), Icon_Utils::iconSet(view->getType()));
+ m_tabWidget->setTabIcon(tabIndex, Icon_Utils::iconSet(view->getType()));
+ m_tabWidget->setTabToolTip(tabIndex, view->getName());
}
- m_tabWidget->setCurrentIndex(m_tabWidget->indexOf(view));
+ m_tabWidget->setCurrentIndex(tabIndex);
}
else {
if (m_viewStack->indexOf(view) < 0) {
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.h #1143484:1143485
@@ -4,7 +4,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * copyright (C) 2002-2009 *
+ * copyright (C) 2002-2010 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -242,7 +242,8 @@
void slotShowGridToggled(bool gridOn);
void slotSelectAll();
void slotDeleteSelectedWidget();
- void slotDeleteDiagram(QWidget* tab = NULL);
+ void slotDeleteDiagram();
+ void slotCloseDiagram(QWidget* tab);
void setZoom(int zoom);
More information about the umbrello-devel
mailing list