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

Ralf Habacker ralf.habacker at gmail.com
Wed Dec 14 20:38:40 UTC 2011


SVN commit 1268760 by habacker:

merged in non QGraphicsScene related changes from soc-umbrello branch for EnumWidget

 M  +6 -3      enumwidget.cpp  
 M  +11 -10    enumwidget.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/enumwidget.cpp #1268759:1268760
@@ -21,9 +21,10 @@
 #include "object_factory.h"
 #include "uml.h"
 #include "umlclassifierlistitemlist.h"
-#include "umlview.h"
 #include "umldoc.h"
+#include "umlscene.h"
 
+
 /**
  * Constructs an instance of EnumWidget.
  *
@@ -31,7 +32,8 @@
  * @param o         The UMLObject this will be representing.
  */
 EnumWidget::EnumWidget(UMLView* view, UMLObject* o)
-  : UMLWidget(view, o)
+  : UMLWidget(view, o),
+	m_showPackage(false)
 {
     init();
 }
@@ -48,7 +50,7 @@
  *
  * @return  True if package is shown.
  */
-bool EnumWidget::getShowPackage() const
+bool EnumWidget::showPackage() const
 {
     return m_showPackage;
 }
@@ -77,6 +79,7 @@
 
 /**
  * Draws the enum as a rectangle with a box underneith with a list of literals
+ * Reimplemented from UMLWidget::paint
  */
 void EnumWidget::paint(QPainter& p, int offsetX, int offsetY)
 {
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/enumwidget.h #1268759:1268760
@@ -28,23 +28,24 @@
  * @see UMLWidget
  * Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
  */
-class EnumWidget : public UMLWidget {
+class EnumWidget : public UMLWidget
+{
+    Q_OBJECT
 public:
-    EnumWidget(UMLView* view, UMLObject* o);
-    ~EnumWidget();
+    explicit EnumWidget(UMLView* view, UMLObject* o);
+    virtual ~EnumWidget();
 
-    // TODO: is this a generic pattern and should be moved to a base class ? 
-    bool getShowPackage() const;
+    bool showPackage() const;
     void setShowPackage(bool _status);
     void toggleShowPackage();
 
-    void paint(QPainter& p, int offsetX, int offsetY);
+    virtual void paint(QPainter& p, int offsetX, int offsetY);
 
-    bool loadFromXMI(QDomElement& qElement);
-    void saveToXMI(QDomDocument& qDoc, QDomElement& qElement);
+    virtual bool loadFromXMI(QDomElement& qElement);
+    virtual void saveToXMI(QDomDocument& qDoc, QDomElement& qElement);
 
-public slots:
-    void slotMenuSelection(QAction* action);
+public Q_SLOTS:
+    virtual void slotMenuSelection(QAction* action);
 
 protected:
     QSize calculateSize();




More information about the umbrello-devel mailing list