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

Brian Thomas thomas at mail630.gsfc.nasa.gov
Wed Apr 14 12:25:16 UTC 2004


CVS commit by thomas: 

ugh. A bug in the Qt interaction between QTextEdit and Menu can sometimes trigger a clear() call of the text area after the popup menu is destroyed. The workaround is to disable the behavior by blocking the destroy signal from the menu.


  M +8 -4      codeeditor.cpp   1.17


--- kdesdk/umbrello/umbrello/dialogs/codeeditor.cpp  #1.16:1.17
@@ -649,13 +649,17 @@ QPopupMenu * CodeEditor::createPopupMenu
         m_lastPara = paragraphAt(pos);
 
-//      return QTextEdit::createPopupMenu ( pos );
         QPopupMenu * menu = new QPopupMenu(this);
+        // ugh. A bug in the Qt interaction between QTextEdit and Menu
+        // can sometimes trigger a clear() call of the text area after
+        // the popup menu is destroyed. The workaround is to disable
+        // the behavior by blocking the destroy signal from the menu.
+        menu->blockSignals(true);
 
         if (m_selectedTextBlock)
         {
                 if(tb->getWriteOutText())
-                        menu->insertItem("Hide",this,SLOT(slotChangeSelectedBlockView()), Key_H , 0);
+                        menu->insertItem("Hide",this,SLOT(slotChangeSelectedBlockView()), Key_H, 0);
                 else
-                        menu->insertItem("Show",this,SLOT(slotChangeSelectedBlockView()), Key_H , 0);
+                        menu->insertItem("Show",this,SLOT(slotChangeSelectedBlockView()), Key_S, 0);
 
                 CodeBlockWithComments * cb = dynamic_cast<CodeBlockWithComments*>(tb);
@@ -664,5 +668,5 @@ QPopupMenu * CodeEditor::createPopupMenu
                                 menu->insertItem("Hide Comment",this,SLOT(slotChangeSelectedBlockCommentView()), CTRL+Key_H, 1);
                         else
-                                menu->insertItem("Show Comment",this,SLOT(slotChangeSelectedBlockCommentView()), CTRL+Key_H, 1);
+                                menu->insertItem("Show Comment",this,SLOT(slotChangeSelectedBlockCommentView()), CTRL+Key_S, 1);
                 menu->insertSeparator();
 






More information about the umbrello-devel mailing list