[Uml-devel] branches/work/soc-umbrello/umbrello

Andi Fischer andi.fischer at hispeed.ch
Sun Jul 1 13:12:33 UTC 2012


SVN commit 1303686 by fischer:

Small code formatting changes applied.

 M  +2 -2      dialogs/umlviewdialog.cpp  
 M  +11 -7     expanderbox.cpp  
 M  +7 -11     expanderbox.h  
 M  +11 -10    textitem.cpp  
 M  +11 -11    textitem.h  
 M  +2 -4      textitemgroup.cpp  
 M  +8 -10     textitemgroup.h  
 M  +2 -2      umlview.cpp  
 M  +1 -1      umlview.h  
 M  +6 -5      widgets/layoutgrid.cpp  
 M  +7 -6      widgets/layoutgrid.h  
 M  +6 -8      widgets/widget_utils.cpp  
 M  +5 -5      widgets/widget_utils.h  
 M  +11 -12    widgets/widgethandle.cpp  
 M  +8 -10     widgets/widgethandle.h  


--- branches/work/soc-umbrello/umbrello/dialogs/umlviewdialog.cpp #1303685:1303686
@@ -28,8 +28,8 @@
 #include <kvbox.h>
 
 // qt includes
-#include <QtGui/QFrame>
-#include <QtGui/QHBoxLayout>
+#include <QFrame>
+#include <QHBoxLayout>
 
 /**
  * Constructor.
--- branches/work/soc-umbrello/umbrello/expanderbox.cpp #1303685:1303686
@@ -19,9 +19,9 @@
 
 #include "expanderbox.h"
 
+#include <QGraphicsSceneMouseEvent>
+#include <QPainter>
 
-#include <QtGui/QPainter>
-
 /// The size for all ExpanderBox
 const qreal ExpanderBox::Size = 10;
 
@@ -37,12 +37,16 @@
     setPen(QPen(Qt::black, 1)); // sets boundingrect.
 }
 
-/// Destructor
+/**
+ * Destructor.
+ */
 ExpanderBox::~ExpanderBox()
 {
 }
 
-/// Sets the current expanded state to \a exp and updates.
+/**
+ * Sets the current expanded state to \a exp and updates.
+ */
 void ExpanderBox::setExpanded(bool exp)
 {
     if (m_expanded != exp) {
@@ -105,7 +109,7 @@
  * Reimplemented from QGraphicsItem::mousePressEvent to toggle current
  * state on left click and also emit the signal @ref expansionToggled
  */
-void ExpanderBox::mousePressEvent(UMLSceneMouseEvent *event)
+void ExpanderBox::mousePressEvent(QGraphicsSceneMouseEvent *event)
 {
     if (event->buttons().testFlag(Qt::LeftButton)) {
         m_expanded = !m_expanded;
@@ -121,7 +125,7 @@
 /**
  * Reimplemented from QGraphicsItem::mouseMoveEvent to ignore it.
  */
-void ExpanderBox::mouseMoveEvent(UMLSceneMouseEvent *event)
+void ExpanderBox::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
 {
     event->ignore();
 }
@@ -129,7 +133,7 @@
 /**
  * Reimplemented from QGraphicsItem::mouseReleaseEvent to ignore it.
  */
-void ExpanderBox::mouseReleaseEvent(UMLSceneMouseEvent *event)
+void ExpanderBox::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
 {
     event->ignore();
 }
--- branches/work/soc-umbrello/umbrello/expanderbox.h #1303685:1303686
@@ -20,13 +20,11 @@
 #ifndef EXPANDERBOX_H
 #define EXPANDERBOX_H
 
-#include "umlscene.h"
-#include <QtCore/QObject>
+#include <QBrush>
+#include <QGraphicsObject>
+#include <QObject>
+#include <QPen>
 
-#include <QtGui/QBrush>
-#include <QtGui/QGraphicsObject>
-#include <QtGui/QPen>
-
 /**
  * This is a simple item which displays a box with +/- on it and
  * toggles this on clicking the box.
@@ -77,13 +75,12 @@
     virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *opt, QWidget*);
 
 signals:
-
     void expansionToggled(bool currentState);
 
 protected:
-    virtual void mousePressEvent(UMLSceneMouseEvent *event);
-    virtual void mouseMoveEvent(UMLSceneMouseEvent *event);
-    virtual void mouseReleaseEvent(UMLSceneMouseEvent *event);
+    virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
 
 private:
     static const qreal Size;
@@ -91,7 +88,6 @@
     bool m_expanded;
     QPen m_pen;
     QBrush m_brush;
-
     QRectF m_boundingRect;
     QPainterPath m_shape;
 };
--- branches/work/soc-umbrello/umbrello/textitem.cpp #1303685:1303686
@@ -19,10 +19,11 @@
 
 #include "textitem.h"
 
-#include <QtGui/QPainter>
-#include <QtGui/QStyleOptionGraphicsItem>
-#include <QtGui/QTextDocument>
-#include <QtGui/QTextOption>
+#include <QGraphicsSceneContextMenuEvent>
+#include <QPainter>
+#include <QStyleOptionGraphicsItem>
+#include <QTextDocument>
+#include <QTextOption>
 
 // Inline and other documentation BEGIN
 
@@ -96,15 +97,15 @@
  *
  * @param parent The parent of this item.
  */
-TextItem::TextItem(const QString& text, QGraphicsItem *parent) :
-    QGraphicsTextItem(text, parent),
+TextItem::TextItem(const QString& text, QGraphicsItem *parent)
+  : QGraphicsTextItem(text, parent),
     m_explicitVisiblity(true)
 {
     setAcceptHoverEvents(false);
 }
 
 /**
- * Destructor
+ * Destructor.
  */
 TextItem::~TextItem()
 {
@@ -274,17 +275,17 @@
     setVisible(actual);
 }
 
-void TextItem::hoverEnterEvent(UMLSceneHoverEvent *)
+void TextItem::hoverEnterEvent(QGraphicsSceneHoverEvent *)
 {
     update();
 }
 
-void TextItem::hoverLeaveEvent(UMLSceneHoverEvent *)
+void TextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *)
 {
     update();
 }
 
-void TextItem::contextMenuEvent(UMLSceneContextMenuEvent *event)
+void TextItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
 {
     event->ignore();
 }
--- branches/work/soc-umbrello/umbrello/textitem.h #1303685:1303686
@@ -20,18 +20,21 @@
 #ifndef TEXTITEM_H
 #define TEXTITEM_H
 
-#include "umlscene.h"
+#include <QBrush>
+#include <QFont>
+#include <QGraphicsTextItem>
 
-#include <QtGui/QBrush>
-#include <QtGui/QFont>
+class QGraphicsItem;
+class QGraphicsSceneContextMenuEvent;
+class QGraphicsSceneHoverEvent;
+class QStyleOptionGraphicsItem;
 
 class TextItem : public QGraphicsTextItem
 {
     Q_OBJECT
 public:
-
     TextItem(const QString& text, QGraphicsItem *parent = 0);
-    ~TextItem();
+    virtual ~TextItem();
 
     Qt::Alignment alignment() const;
     void setAlignment(Qt::Alignment align);
@@ -63,13 +66,11 @@
 
     void setFont(QFont font);
 
-
     QBrush hoverBrush() const {
         return m_hoverBrush;
     }
     void setHoverBrush(const QBrush& brush);
 
-
     QBrush backgroundBrush() const {
         return m_backgroundBrush;
     }
@@ -86,14 +87,13 @@
     void updateVisibility();
 
 protected:
-    void hoverEnterEvent(UMLSceneHoverEvent *event);
-    void hoverLeaveEvent(UMLSceneHoverEvent *event);
-    void contextMenuEvent(UMLSceneContextMenuEvent *event);
+    void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
+    void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
+    void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
 
 private:
     QBrush m_hoverBrush;
     QBrush m_backgroundBrush;
-
     bool m_explicitVisiblity;
 };
 
--- branches/work/soc-umbrello/umbrello/textitemgroup.cpp #1303685:1303686
@@ -22,12 +22,10 @@
 #include "debug_utils.h"
 #include "textitem.h"
 
-#include <QtGui/QGraphicsScene>
-
 const qreal TextItemGroup::NoLineBreak = -1;
 
-TextItemGroup::TextItemGroup(QGraphicsItem *parent) :
-    m_parentItem(parent),
+TextItemGroup::TextItemGroup(QGraphicsItem *parent)
+  : m_parentItem(parent),
     m_lineBreakageWidth(TextItemGroup::NoLineBreak),
     m_margin(0),
     m_alignment(Qt::AlignCenter),
--- branches/work/soc-umbrello/umbrello/textitemgroup.h #1303685:1303686
@@ -20,13 +20,13 @@
 #ifndef TEXTITEMGROUP_H
 #define TEXTITEMGROUP_H
 
-#include <QtCore/QList>
-#include <QtCore/QPointF>
-#include <QtCore/QRectF>
-#include <QtCore/QSizeF>
-#include <QtGui/QBrush>
-#include <QtGui/QColor>
-#include <QtGui/QFont>
+#include <QBrush>
+#include <QColor>
+#include <QFont>
+#include <QList>
+#include <QPointF>
+#include <QRectF>
+#include <QSizeF>
 
 class QGraphicsItem;
 class TextItem;
@@ -37,7 +37,7 @@
     static const qreal NoLineBreak;
 
     TextItemGroup(QGraphicsItem *parent = 0);
-    ~TextItemGroup();
+    virtual ~TextItemGroup();
 
     QGraphicsItem* parentItem() const {
         return m_parentItem;
@@ -115,7 +115,6 @@
     QRectF m_groupGeometry;
     qreal m_lineBreakageWidth;
     qreal m_margin;
-
     Qt::Alignment m_alignment;
     QColor m_textColor;
     QBrush m_hoverBrush;
@@ -123,5 +122,4 @@
     QFont m_font;
 };
 
-
 #endif //TEXTITEMGROUP_H
--- branches/work/soc-umbrello/umbrello/umlview.cpp #1303685:1303686
@@ -18,7 +18,7 @@
 #include "umldoc.h"
 #include "worktoolbar.h"
 
-#include <QtGui/QMouseEvent>
+#include <QMouseEvent>
 
 /**
  * Constructor
@@ -40,7 +40,7 @@
 }
 
 /**
- * Destructor
+ * Destructor.
  */
 UMLView::~UMLView()
 {
--- branches/work/soc-umbrello/umbrello/umlview.h #1303685:1303686
@@ -11,7 +11,7 @@
 #ifndef UMLVIEW_H
 #define UMLVIEW_H
 
-#include <QtGui/QGraphicsView>
+#include <QGraphicsView>
 
 class QHideEvent;
 class QCloseEvent;
--- branches/work/soc-umbrello/umbrello/widgets/layoutgrid.cpp #1303685:1303686
@@ -21,9 +21,10 @@
 
 #include "debug_utils.h"
 
-#include <QtGui/QGraphicsScene>
-#include <QtGui/QPainter>
-#include <QtCore/QTextStream>
+#include <QGraphicsScene>
+#include <QGraphicsSceneMouseEvent>
+#include <QPainter>
+#include <QTextStream>
 
 /**
  * Constructor.
@@ -189,7 +190,7 @@
     m_isTextVisible = visible;
 }
 
-void LayoutGrid::mousePressEvent(UMLSceneMouseEvent *event)
+void LayoutGrid::mousePressEvent(QGraphicsSceneMouseEvent *event)
 {
     QPoint pos = event->pos().toPoint();
     DEBUG("LayoutGrid") << "at position: " << pos;
@@ -203,7 +204,7 @@
     }
 }
 
-void LayoutGrid::mouseReleaseEvent(UMLSceneMouseEvent *event)
+void LayoutGrid::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
 {
     Q_UNUSED(event);
     if (m_coordLabel->isVisible()) {
--- branches/work/soc-umbrello/umbrello/widgets/layoutgrid.h #1303685:1303686
@@ -20,11 +20,12 @@
 #ifndef LAYOUTGRID_H
 #define LAYOUTGRID_H
 
-#include "umlscene.h"
+#include <QColor>
+#include <QFont>
+#include <QGraphicsItem>
 
-#include <QtGui/QColor>
-#include <QtGui/QFont>
-#include <QtGui/QGraphicsItem>
+class QGraphicsScene;
+class QStyleOptionGraphicsItem;
 
 /**
  * @author Andi Fischer
@@ -66,8 +67,8 @@
     void setTextVisible(bool visible);
 
 protected:
-     void mousePressEvent(UMLSceneMouseEvent *event);
-     void mouseReleaseEvent(UMLSceneMouseEvent *event);
+     void mousePressEvent(QGraphicsSceneMouseEvent *event);
+     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
 
 private:
     int                 m_gridSpacingX;
--- branches/work/soc-umbrello/umbrello/widgets/widget_utils.cpp #1303685:1303686
@@ -12,18 +12,18 @@
 #include "widget_utils.h"
 
 // app includes
+#include "debug_utils.h"
 #include "objectwidget.h"
+#include "messagewidget.h"
 #include "uml.h"
 #include "umlscene.h"
 #include "umlview.h"
 #include "umlwidget.h"
 
 // qt includes
-#include <QtCore/QBuffer>
-#include <QtGui/QBrush>
-#include <QtGui/QImageReader>
-#include <QtGui/QPen>
-#include <QtGui/QPolygonF>
+#include <QBuffer>
+#include <QImageReader>
+#include <QPolygonF>
 
 // c++ include
 #include <cmath>
@@ -37,8 +37,7 @@
      *
      * @param id            The unique ID to find.
      * @param widgets       The UMLWidgetList to search in.
-     * @param pMessages     Optional pointer to a MessageWidgetList to
-     *                      search in.
+     * @param messages   Optional pointer to a MessageWidgetList to search in.
      */
     UMLWidget* findWidget(Uml::IDType id,
                           const UMLWidgetList& widgets,
@@ -59,7 +58,6 @@
                     return obj;
             }
         }
-
         return NULL;
     }
 
--- branches/work/soc-umbrello/umbrello/widgets/widget_utils.h #1303685:1303686
@@ -16,11 +16,11 @@
 #include "umlscene.h"
 #include "umlwidgetlist.h"
 
-#include <QtCore/QPoint>
-#include <QtXml/QDomDocument>
-#include <QtGui/QBrush>
-#include <QtGui/QPen>
-#include <QtGui/QFont>
+#include <QBrush>
+#include <QDomDocument>
+#include <QFont>
+#include <QPen>
+#include <QPoint>
 
 /**
  * General purpose widget utilities.
--- branches/work/soc-umbrello/umbrello/widgets/widgethandle.cpp #1303685:1303686
@@ -22,10 +22,9 @@
 #include "debug_utils.h"
 #include "umlwidget.h"
 
-#include <QtGui/QPainter>
+#include <QCursor>
+#include <QPainter>
 
-#include <QtGui/QCursor>
-
 /**
  * @class WidgetHandle
  *
@@ -101,8 +100,8 @@
  *               WidgetHandle should be associated with. \a widget is
  *               also is the parent item for this WidgetHandle item.
  */
-WidgetHandle::WidgetHandle(UMLWidget *widget) :
-    QGraphicsItem(widget),
+WidgetHandle::WidgetHandle(UMLWidget *widget)
+  : QGraphicsItem(widget),
     m_widget(widget)
 {
     for(int i = rh_TopLeft; i < rh_None; ++i) {
@@ -143,7 +142,7 @@
  *
  * @see WidgetHandle::isActive()
  */
-void WidgetHandle::mousePressEvent(UMLSceneMouseEvent *event)
+void WidgetHandle::mousePressEvent(QGraphicsSceneMouseEvent *event)
 {
     if(!isActive() || !m_widget->isResizable() || event->button() != Qt::LeftButton) {
         m_pressedHandle = rh_None;
@@ -163,7 +162,7 @@
 /**
  * @copydoc WidgetHandle::mousePressEvent
  */
-void WidgetHandle::mouseMoveEvent(UMLSceneMouseEvent *event)
+void WidgetHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
 {
     // Should not happen
     if(m_pressedHandle == rh_None) {
@@ -286,7 +285,7 @@
 /**
  * @copydoc WidgetHandle::mousePressEvent
  */
-void WidgetHandle::mouseReleaseEvent(UMLSceneMouseEvent *event)
+void WidgetHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
 {
     Q_UNUSED(event);
     // reset the pressed handle
@@ -299,7 +298,7 @@
  *
  * @see WidgetHandle::handleCursorChange
  */
-void WidgetHandle::hoverEnterEvent(UMLSceneHoverEvent *event)
+void WidgetHandle::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
 {
     handleCursorChange(event);
 }
@@ -307,7 +306,7 @@
 /**
  * @copydoc WidgetHandle::hoverEnterEvent
  */
-void WidgetHandle::hoverMoveEvent(UMLSceneHoverEvent *event)
+void WidgetHandle::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
 {
     handleCursorChange(event);
 }
@@ -315,7 +314,7 @@
 /**
  * @copydoc WidgetHandle::hoverEnterEvent
  */
-void WidgetHandle::hoverLeaveEvent(UMLSceneHoverEvent *event)
+void WidgetHandle::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
 {
     handleCursorChange(event);
 }
@@ -405,7 +404,7 @@
  * @note The cursor set is Qt::ArrowCursor if either this handle is
  *       not active or the associated widget is not resizable.
  */
-void WidgetHandle::handleCursorChange(UMLSceneHoverEvent *event)
+void WidgetHandle::handleCursorChange(QGraphicsSceneHoverEvent *event)
 {
     if(!isActive() || !m_widget->isResizable()) {
         setCursor(QCursor(Qt::ArrowCursor));
--- branches/work/soc-umbrello/umbrello/widgets/widgethandle.h #1303685:1303686
@@ -20,8 +20,7 @@
 #ifndef WIDGETHANDLE_H
 #define WIDGETHANDLE_H
 
-#include "umlscene.h"
-#include <QtGui/QGraphicsItem>
+#include <QGraphicsItem>
 
 class UMLWidget;
 
@@ -60,23 +59,22 @@
     void paint(QPainter *p, const QStyleOptionGraphicsItem *opt, QWidget *w);
 
 protected:
-    void mousePressEvent(UMLSceneMouseEvent *event);
-    void mouseMoveEvent(UMLSceneMouseEvent *event);
-    void mouseReleaseEvent(UMLSceneMouseEvent *event);
+    void mousePressEvent(QGraphicsSceneMouseEvent *event);
+    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
 
-    void hoverEnterEvent(UMLSceneHoverEvent *event);
-    void hoverMoveEvent(UMLSceneHoverEvent *event);
-    void hoverLeaveEvent(UMLSceneHoverEvent *event);
+    void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
+    void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
+    void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
 
 private:
     bool isActive() const;
     void calcResizeHandles();
-    void handleCursorChange(UMLSceneHoverEvent *event);
+    void handleCursorChange(QGraphicsSceneHoverEvent *event);
 
     UMLWidget *m_widget;
     QRectF m_boundingRect;
     QPainterPath m_shape;
-
     QRectF m_resizeHandles[8];
     ResizeHandle m_pressedHandle;
 };




More information about the umbrello-devel mailing list