Suggestions to improve code in WidgetBase.h / .cpp

Robert Hairgrove code at roberthairgrove.com
Mon Jan 10 20:48:01 GMT 2022


On 2021-12-31 05:51, Robert Hairgrove wrote:
>   WidgetBase& operator=(const WidgetBase& other)...

I believe that the assignment operators for WidgetBase, 
DiagramProxyWidget, and UmlWidget can all be removed. I did this and was 
still able to compile everything, so I think they must not be used by 
any other code. The implementation of UmlWidget::operator= DOES use the 
other two, since it inherits both of them, but its own assignment 
operator is not used, AFAICT.

Might also be a good idea to use Q_DISABLE_COPY(...) on these classes.

In diagramproxywidget.h/.cpp the following functions should be declared 
const:

     const QRectF &clientRect();
     const QRectF &sceneRect();
     UMLWidget *DiagramProxyWidget::getProxiedWidget(const QPointF &p);
     bool DiagramProxyWidget::isProxyWidget();
     UMLWidget *DiagramProxyWidget::getProxiedWidget(const QPointF &p);
     QPointF DiagramProxyWidget::mapFromClient(const QPointF &pos);
     QRectF DiagramProxyWidget::mapFromClient(const QRectF &r);
     QPointF DiagramProxyWidget::mapToClient(const QPointF &pos);
     void DiagramProxyWidget::setupEvent(QGraphicsSceneMouseEvent &e, 
QGraphicsSceneMouseEvent *event, const QPointF & pos);
     void DiagramProxyWidget::setupEvent(QGraphicsSceneContextMenuEvent 
&e, QGraphicsSceneContextMenuEvent *event, const QPointF & pos);


More information about the umbrello-devel mailing list