umbrello 26.07.70-c53146a Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QGraphicsObjectWrapper Class Reference

`#include <widgetbase.h>`

Inheritance diagram for QGraphicsObjectWrapper:

## Public Member Functions

virtual void | setSelected (bool state)

## Protected Member Functions

QVariant | itemChange (GraphicsItemChange change, const QVariant &value)

## Protected Attributes

bool | m_calledFromItemChange {false}

## Detailed Description

Provides a wrapper that bypasses the restriction that QGraphicsItem::setSelected() is not virtual

The selection management of umbrello uses a virtual method setSelected() for selection to achieve the desired behavior in the different derivation levels regarding selection and deselection.

Within QGraphicsScene, QGraphicsItem::setSelected() is called to manage the selection state, e.g. with clearSelection(), but unfortunately cannot be directly overwritten by umbrello because this method is not virtual (I consider this a design flaw).

Fortunately there is a workaround for the problem by using QGraphicsItem::itemChange(), which is overridden in this class and calls the (now) virtual method setSelected() when the selection state changes. This calls derived implementations of this method and realizes the desired behavior.

Within setSelected() you have to take care that QGraphicsObject::setSelected() is not called if the call came from itemChange() to avoid an endless loop.

Author
  Ralf Habacker ralf..nosp@m.haba.nosp@m.cker@.nosp@m.free.nosp@m.net.d.nosp@m.e

## Member Function Documentation

## ◆ itemChange()

QVariant QGraphicsObjectWrapper::itemChange | ( | GraphicsItemChange | change,
|  | const QVariant & | value
| ) |  |

protected

## ◆ setSelected()

void QGraphicsObjectWrapper::setSelected | ( | bool | state | ) |

virtual

Reimplemented in AssociationWidget, MessageWidget, UMLWidget, WidgetBase, and ObjectWidget.

## Member Data Documentation

## ◆ m_calledFromItemChange

bool QGraphicsObjectWrapper::m_calledFromItemChange {false}

protected

The documentation for this class was generated from the following files:

- umbrello/umlwidgets/widgetbase.h
- umbrello/umlwidgets/widgetbase.cpp