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

Andi Fischer andi.fischer at hispeed.ch
Sun Apr 4 15:04:08 UTC 2010


SVN commit 1110984 by fischer:

Patch from Eike Lange applied.

 M  +1 -2      controller/notewidgetcontroller.cpp  
 M  +0 -76     widgets/notewidget.cpp  
 M  +0 -7      widgets/notewidget.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/controller/notewidgetcontroller.cpp #1110983:1110984
@@ -36,14 +36,13 @@
 /**
  * Overridden from UMLWidgetController.
  * Handles a mouse move event.
- * Executes base code and then sets the geometry of the editor.
+ * Executes base code
  *
  * @param me The QMouseEvent event.
  */
 void NoteWidgetController::mouseMoveEvent(QMouseEvent *me)
 {
     UMLWidgetController::mouseMoveEvent(me);
-    m_noteWidget->setEditorGeometry();
 }
 
 /**
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/notewidget.cpp #1110983:1110984
@@ -12,7 +12,6 @@
 #include "notewidget.h"
 //qt includes
 #include <QtGui/QPainter>
-#include <q3textedit.h>
 #include <QtGui/QFrame>
 // kde includes
 #include <kdebug.h>
@@ -28,8 +27,6 @@
 #include "listpopupmenu.h"
 #include "dialog_utils.h"
 
-#define NOTEMARGIN 10
-
 NoteWidget::NoteWidget(UMLView * view, NoteType noteType , Uml::IDType id)
   : UMLWidget(view, id, new NoteWidgetController(this))
 {
@@ -37,22 +34,6 @@
     m_NoteType = noteType;
     setSize(100,80);
     setZ( 20 ); //make sure always on top.
-#ifdef NOTEWIDGET_EMBED_EDITOR
-    // NB: This code is currently deactivated because
-    // Zoom does not yet work with the embedded text editor.
-    m_pEditor = new Q3TextEdit(view);
-    m_pEditor->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
-    m_pEditor->setHScrollBarMode(Q3ScrollView::AlwaysOff);
-    m_pEditor->setVScrollBarMode(Q3ScrollView::AlwaysOff);
-    m_pEditor->setTextFormat(Qt::RichText);
-    m_pEditor->setShown(true);
-    setEditorGeometry();
-    setNoteType(noteType);
-
-    connect(m_pView, SIGNAL(contentsMoving(int, int)),
-            this, SLOT(slotViewScrolled(int, int)));
-#endif
-
 }
 
 void NoteWidget::init()
@@ -90,9 +71,6 @@
 
 NoteWidget::~NoteWidget()
 {
-#ifdef NOTEWIDGET_EMBED_EDITOR
-    delete m_pEditor;
-#endif
 }
 
 void NoteWidget::setDiagramLink(Uml::IDType viewID)
@@ -104,14 +82,8 @@
         return;
     }
     QString linkText("Diagram: " + view->getName());
-#if defined (NOTEWIDGET_EMBED_EDITOR)
-    m_pEditor->setUnderline(true);
-    m_pEditor->insert(linkText);
-    m_pEditor->setUnderline(false);
-#else
     setDocumentation(linkText);
     update();
-#endif
     m_DiagramLink = viewID;
 }
 
@@ -120,61 +92,30 @@
     return m_DiagramLink;
 }
 
-void NoteWidget::slotViewScrolled(int x, int y)
-{
-    setEditorGeometry(x, y);
-}
 
 void NoteWidget::setFont(QFont font)
 {
     UMLWidget::setFont(font);
-#ifdef NOTEWIDGET_EMBED_EDITOR
-    m_pEditor->setFont(font);
-#endif
 }
 
-void NoteWidget::setEditorGeometry(int dx /*=0*/, int dy /*=0*/)
-{
-#if defined (NOTEWIDGET_EMBED_EDITOR)
-    const QRect editorGeometry( UMLWidget::getX() - dx + 6,
-                                UMLWidget::getY() - dy + 10,
-                                UMLWidget::getWidth() - 16,
-                                UMLWidget::getHeight() - 16);
-    m_pEditor->setGeometry( editorGeometry );
-    drawText();
-#else
-    dx=0; dy=0;   // avoid "unused arg" warnings
-#endif
-}
-
 void NoteWidget::setX( int x )
 {
     UMLWidget::setX(x);
-    setEditorGeometry();
 }
 
 void NoteWidget::setY( int y )
 {
     UMLWidget::setY(y);
-    setEditorGeometry();
 }
 
 QString NoteWidget::documentation() const
 {
-#if defined (NOTEWIDGET_EMBED_EDITOR)
-    return m_pEditor->text();
-#else
     return m_Text;
-#endif
 }
 
 void NoteWidget::setDocumentation(const QString &newText)
 {
-#if defined (NOTEWIDGET_EMBED_EDITOR)
-    m_pEditor->setText(newText);
-#else
     m_Text = newText;
-#endif
 }
 
 void NoteWidget::draw(QPainter & p, int offsetX, int offsetY)
@@ -198,9 +139,6 @@
         QBrush brush( UMLWidget::getFillColour() );
         p.setBrush(brush);
         p.drawPolygon(poly);
-#if defined (NOTEWIDGET_EMBED_EDITOR)
-        m_pEditor->setPaper(brush);
-#endif
     } else
         p.drawPolyline(poly);
     p.drawLine(offsetX + w - margin, offsetY, offsetX + w - margin, offsetY + margin);
@@ -262,12 +200,6 @@
     UMLDoc *doc = UMLApp::app()->getDocument();
     ListPopupMenu::Menu_Type sel = m_pMenu->getMenuType(action);
     switch(sel) {
-        ///OBSOLETE - remove ListPopupMenu::mt_Link_Docs
-        // case ListPopupMenu::mt_Link_Docs:
-        //      m_pView->updateNoteWidgets();
-        //      doc -> setModified(true);
-        //      break;
-
     case ListPopupMenu::mt_Rename:
         m_pView -> updateDocumentation( false );
         dlg = new NoteDialog( m_pView, this );
@@ -287,11 +219,6 @@
 
 void NoteWidget::drawText(QPainter * p /*=NULL*/, int offsetX /*=0*/, int offsetY /*=0*/)
 {
-#if defined (NOTEWIDGET_EMBED_EDITOR)
-    m_pEditor->setText( getDoc() );
-    m_pEditor->setShown(true);
-    m_pEditor->repaint();
-#else
     if (p == NULL)
         return;
     /*
@@ -320,8 +247,6 @@
     QChar returnChar('\n');
     QChar c;
 
- //   QString text = getDoc();
-    //QString text = l_Type + "\n" + m_Text;
     if( text.length() == 0 )
         return;
 
@@ -383,7 +308,6 @@
                 word += c;
         }
     }//end for
-#endif
 }
 
 void NoteWidget::askForNoteType(UMLWidget* &targetWidget)
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/notewidget.h #1110983:1110984
@@ -19,7 +19,6 @@
 
 // Qt forward declarations
 class QPainter;
-class Q3TextEdit;
 
 /**
  * Displays a note box to allow multiple lines of text to be displayed.
@@ -144,7 +143,6 @@
 
 public slots:
     void slotMenuSelection(QAction* action);
-    void slotViewScrolled(int x, int y);
 
 protected:
     // Data loaded/saved
@@ -170,12 +168,7 @@
      */
     void init();
 
-    void setEditorGeometry(int dx = 0, int dy = 0);
-#if defined (NOTEWIDGET_EMBED_EDITOR)
-    Q3TextEdit *m_pEditor;
-#else
     QString m_Text;
-#endif
 };
 
 #endif




More information about the umbrello-devel mailing list