BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
RectangleView Class Reference

Description

This is a View of rectangular mask (represented by RectangleItem) on GraphicsScene. Given view follows standard QGraphicsScene notations: (x,y) is top left corner.

Definition at line 25 of file RectangleView.h.

Inheritance diagram for RectangleView:
[legend]
Collaboration diagram for RectangleView:
[legend]

Public Member Functions

 RectangleView (RectangleItem *item)
 
 ~RectangleView () override
 
virtual void addView (IShape2DView *childView, int row=0)
 
QRectF boundingRect () const override
 
SessionItemparameterizedItem () const override
 
void setSceneAdaptor (const ISceneAdaptor *adaptor)
 
QPainterPath shape () const override
 
int type () const override
 

Protected Slots

void onChangedX () override
 
void onChangedY () override
 
void onPropertyChange () override
 

Protected Member Functions

bool blockOnProperty () const
 
qreal bottom () const override
 Returns the y-coordinate of the rectangle's bottom edge. More...
 
void create_size_handle_elements ()
 
void disconnectFromItem (SessionItem *item)
 
qreal fromSceneX (qreal value) const
 convert scene coordinates to ColorMap plot coordinates More...
 
qreal fromSceneY (qreal value) const
 
qreal height () const
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 Track if item selected/deselected and show/hide size handles. More...
 
qreal left () const override
 Returns the x-coordinate of the rectangle's left edge. More...
 
QRectF mask_rectangle () override
 
QPainterPath maskedShape () const
 Returns the shape with all masking already applied. More...
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
 
qreal right () const override
 Returns the x-coordinate of the rectangle's right edge. More...
 
void setBlockOnProperty (bool value)
 
qreal top () const override
 Returns the y-coordinate of the rectangle's top edge. More...
 
qreal toSceneX (qreal value) const
 
qreal toSceneY (qreal value) const
 
virtual void update_bounding_rect ()
 updates view's bounding rectangle using item properties More...
 
void update_position () override
 updates position of view using item properties More...
 
void update_view () override
 update visual appearance of view (triggered by ISceneAdaptor) More...
 
qreal width () const
 Returns width of the rectangle. More...
 

Protected Attributes

SizeHandleElementm_activeHandleElement
 
const ISceneAdaptorm_adaptor
 
bool m_block_on_property_change
 
QRectF m_bounding_rect
 
QRectF m_mask_rect
 mask rectangle in scene coordinates More...
 
QMap< SizeHandleElement::EHandleLocation, SizeHandleElement * > m_resize_handles
 coordinates of corner opposite to the grip corner at the moment it first clicked in scene coordinates More...
 
QPointF m_resize_opposite_origin
 

Private Slots

void onSizeHandleElementRequest (bool going_to_resize)
 triggered by SizeHandleElement More...
 

Private Member Functions

void onItemDestroyed () override
 
void onItemPropertyChange (const QString &propertyName)
 

Private Attributes

RectangleItemm_item
 

Constructor & Destructor Documentation

◆ RectangleView()

RectangleView::RectangleView ( RectangleItem item)
explicit

Definition at line 20 of file RectangleView.cpp.

21  : RectangleBaseView(item)
22  , m_item(item)
23 {
24 }
RectangleBaseView(SessionItem *item)
RectangleItem * m_item
Definition: RectangleView.h:56

◆ ~RectangleView()

RectangleView::~RectangleView ( )
override

Definition at line 26 of file RectangleView.cpp.

27 {
29 }
void disconnectFromItem(SessionItem *item)

References IShape2DView::disconnectFromItem(), and m_item.

Here is the call graph for this function:

Member Function Documentation

◆ addView()

void IShape2DView::addView ( IShape2DView childView,
int  row = 0 
)
virtualinherited

Reimplemented in PolygonView.

Definition at line 129 of file IShape2DView.cpp.

130 {
131  if (!childItems().contains(childView))
132  childView->setParentItem(this);
133 }

Referenced by MaskGraphicsScene::updateViews().

◆ blockOnProperty()

bool IShape2DView::blockOnProperty ( ) const
protectedinherited

Definition at line 140 of file IShape2DView.cpp.

141 {
143 }
bool m_block_on_property_change
Definition: IShape2DView.h:69

References IShape2DView::m_block_on_property_change.

◆ bottom()

qreal RectangleView::bottom ( ) const
overrideprotectedvirtual

Returns the y-coordinate of the rectangle's bottom edge.

Implements RectangleBaseView.

Definition at line 125 of file RectangleView.cpp.

126 {
127  return toSceneY(m_item->yLow());
128 }
qreal toSceneY(qreal value) const
DoubleDescriptor yLow() const
Definition: MaskItems.cpp:158

References m_item, IShape2DView::toSceneY(), and RectangleItem::yLow().

Here is the call graph for this function:

◆ boundingRect()

QRectF IShape2DView::boundingRect ( ) const
overrideinherited

Definition at line 50 of file IShape2DView.cpp.

51 {
52  return m_bounding_rect;
53 }
QRectF m_bounding_rect
Definition: IShape2DView.h:68

References IShape2DView::m_bounding_rect.

◆ create_size_handle_elements()

void RectangleBaseView::create_size_handle_elements ( )
protectedinherited

Definition at line 103 of file RectangleBaseView.cpp.

104 {
105  QList<SizeHandleElement::EHandleLocation> points;
110 
111  for (SizeHandleElement::EHandleLocation point_type : points) {
112  auto* el = new SizeHandleElement(point_type, this);
113  connect(el, &SizeHandleElement::resize_request, this,
115  el->setVisible(false);
116  m_resize_handles[point_type] = el;
117  }
118 }
void onSizeHandleElementRequest(bool going_to_resize)
triggered by SizeHandleElement
QMap< SizeHandleElement::EHandleLocation, SizeHandleElement * > m_resize_handles
coordinates of corner opposite to the grip corner at the moment it first clicked in scene coordinates
Size handle on top of RectangleView represented as small circle or small rectangle....
void resize_request(bool going_to_resize)

References SizeHandleElement::BOTTOMLEFT, SizeHandleElement::BOTTOMMIDLE, SizeHandleElement::BOTTOMRIGHT, RectangleBaseView::m_resize_handles, SizeHandleElement::MIDDLELEFT, SizeHandleElement::MIDDLERIGHT, RectangleBaseView::onSizeHandleElementRequest(), SizeHandleElement::resize_request(), SizeHandleElement::TOPLEFT, SizeHandleElement::TOPMIDDLE, and SizeHandleElement::TOPRIGHT.

Referenced by RectangleBaseView::RectangleBaseView().

Here is the call graph for this function:

◆ disconnectFromItem()

void IShape2DView::disconnectFromItem ( SessionItem item)
protectedinherited

Definition at line 145 of file IShape2DView.cpp.

146 {
147  if (item)
148  item->mapper()->unsubscribe(this);
149 }
void unsubscribe(const void *caller)
Cancels all subscriptions of given caller.
Definition: ModelMapper.cpp:78
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.

References SessionItem::mapper(), and ModelMapper::unsubscribe().

Referenced by EllipseView::~EllipseView(), HorizontalLineView::~HorizontalLineView(), MaskAllView::~MaskAllView(), MaskContainerView::~MaskContainerView(), PolygonPointView::~PolygonPointView(), PolygonView::~PolygonView(), ~RectangleView(), and VerticalLineView::~VerticalLineView().

Here is the call graph for this function:

◆ fromSceneX()

qreal IShape2DView::fromSceneX ( qreal  value) const
protectedinherited

convert scene coordinates to ColorMap plot coordinates

Definition at line 119 of file IShape2DView.cpp.

120 {
121  return m_adaptor ? m_adaptor->fromSceneX(value) : value;
122 }
virtual qreal fromSceneX(qreal) const =0
convert scene x-coordinate to native mask coordinate
const ISceneAdaptor * m_adaptor
Definition: IShape2DView.h:67

References ISceneAdaptor::fromSceneX(), and IShape2DView::m_adaptor.

Referenced by EllipseView::mouseMoveEvent(), mouseMoveEvent(), EllipseView::onChangedX(), VerticalLineView::onChangedX(), onChangedX(), and PolygonPointView::updateParameterizedItem().

Here is the call graph for this function:

◆ fromSceneY()

qreal IShape2DView::fromSceneY ( qreal  value) const
protectedinherited

Definition at line 124 of file IShape2DView.cpp.

125 {
126  return m_adaptor ? m_adaptor->fromSceneY(value) : value;
127 }
virtual qreal fromSceneY(qreal) const =0
convert scene y-coordinate to native mask coordinate

References ISceneAdaptor::fromSceneY(), and IShape2DView::m_adaptor.

Referenced by EllipseView::mouseMoveEvent(), mouseMoveEvent(), EllipseView::onChangedY(), HorizontalLineView::onChangedY(), onChangedY(), and PolygonPointView::updateParameterizedItem().

Here is the call graph for this function:

◆ height()

qreal RectangleBaseView::height ( ) const
protectedinherited

Definition at line 98 of file RectangleBaseView.cpp.

99 {
100  return bottom() - top();
101 }
virtual qreal top() const =0
virtual qreal bottom() const =0

References RectangleBaseView::bottom(), and RectangleBaseView::top().

Referenced by EllipseView::mask_rectangle(), mask_rectangle(), and EllipseView::mouseMoveEvent().

Here is the call graph for this function:

◆ itemChange()

QVariant RectangleBaseView::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
overrideprotectedinherited

Track if item selected/deselected and show/hide size handles.

Definition at line 51 of file RectangleBaseView.cpp.

53 {
54  if (change == QGraphicsItem::ItemSelectedChange) {
55  for (auto it = m_resize_handles.begin(); it != m_resize_handles.end(); ++it)
56  it.value()->setVisible(!this->isSelected());
57  }
58  return value;
59 }

References RectangleBaseView::m_resize_handles.

◆ left()

qreal RectangleView::left ( ) const
overrideprotectedvirtual

Returns the x-coordinate of the rectangle's left edge.

Implements RectangleBaseView.

Definition at line 104 of file RectangleView.cpp.

105 {
106  return toSceneX(m_item->xLow());
107 }
qreal toSceneX(qreal value) const
DoubleDescriptor xLow() const
Definition: MaskItems.cpp:148

References m_item, IShape2DView::toSceneX(), and RectangleItem::xLow().

Here is the call graph for this function:

◆ mask_rectangle()

QRectF RectangleView::mask_rectangle ( )
overrideprotectedvirtual

Implements RectangleBaseView.

Definition at line 97 of file RectangleView.cpp.

98 {
99  return QRectF(0.0, 0.0, width(), height());
100 }
qreal width() const
Returns width of the rectangle.

References RectangleBaseView::height(), and RectangleBaseView::width().

Here is the call graph for this function:

◆ maskedShape()

QPainterPath IShape2DView::maskedShape ( ) const
protectedinherited

Returns the shape with all masking already applied.

Definition at line 79 of file IShape2DView.cpp.

80 {
81  static const QSet<MaskEditorHelper::EViewTypes> relevantMaskTypes = {
84 
85  QPainterPath resultingShape = mapToScene(shape());
86  for (auto* item : scene()->items()) {
87  auto* const maskItem = dynamic_cast<IShape2DView*>(item);
88  if (!maskItem
89  || !relevantMaskTypes.contains((MaskEditorHelper::EViewTypes)maskItem->type()))
90  continue;
91 
92  const bool isMaskingItem = itemMaskValue(maskItem->parameterizedItem());
93  const bool isOnTop = maskItem->zValue() > zValue();
94  if (isMaskingItem || !isOnTop)
95  continue;
96 
97  const auto maskItemShape = maskItem->mapToScene(maskItem->shape());
98  if (!maskItemShape.intersects(resultingShape))
99  continue;
100 
101  // Item lays on top and is non-masking -> subtract the
102  // path of the item
103  resultingShape = resultingShape.subtracted(maskItemShape);
104  }
105 
106  return mapFromScene(resultingShape);
107 }
Main interface class for views representing MaskItems, Projections on graphics scene.
Definition: IShape2DView.h:27

References MaskEditorHelper::ELLIPSE, MaskEditorHelper::HORIZONTALLINE, MaskEditorHelper::POLYGON, MaskEditorHelper::RECTANGLE, and MaskEditorHelper::VERTICALLINE.

Referenced by IShape2DView::paint().

◆ mouseMoveEvent()

void RectangleView::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotected

Definition at line 64 of file RectangleView.cpp.

65 {
67  qreal xmin = std::min(event->scenePos().x(), m_resize_opposite_origin.x());
68  qreal xmax = std::max(event->scenePos().x(), m_resize_opposite_origin.x());
69  qreal ymin = std::min(event->scenePos().y(), m_resize_opposite_origin.y());
70  qreal ymax = std::max(event->scenePos().y(), m_resize_opposite_origin.y());
71 
73  m_item->setXLow(fromSceneX(xmin));
74  m_item->setYLow(fromSceneY(ymax));
75  m_item->setXUp(fromSceneX(xmax));
76  m_item->setYUp(fromSceneY(ymin));
78  m_item->setYLow(fromSceneY(ymax));
79  m_item->setYUp(fromSceneY(ymin));
81  m_item->setXLow(fromSceneX(xmin));
82  m_item->setXUp(fromSceneX(xmax));
83  }
84  update_view();
85  } else {
86  IShape2DView::mouseMoveEvent(event);
87  }
88 }
qreal fromSceneY(qreal value) const
qreal fromSceneX(qreal value) const
convert scene coordinates to ColorMap plot coordinates
SizeHandleElement * m_activeHandleElement
void update_view() override
update visual appearance of view (triggered by ISceneAdaptor)
QPointF m_resize_opposite_origin
void setXLow(double x_low)
Definition: MaskItems.cpp:153
void setXUp(double x_up)
Definition: MaskItems.cpp:173
void setYLow(double y_low)
Definition: MaskItems.cpp:163
void setYUp(double y_up)
Definition: MaskItems.cpp:183
EHandleType getHandleType() const

References IShape2DView::fromSceneX(), IShape2DView::fromSceneY(), SizeHandleElement::getHandleType(), RectangleBaseView::m_activeHandleElement, m_item, RectangleBaseView::m_resize_opposite_origin, SizeHandleElement::RESIZE, SizeHandleElement::RESIZE_HEIGHT, SizeHandleElement::RESIZE_WIDTH, RectangleItem::setXLow(), RectangleItem::setXUp(), RectangleItem::setYLow(), RectangleItem::setYUp(), and RectangleBaseView::update_view().

Here is the call graph for this function:

◆ mouseReleaseEvent()

void RectangleBaseView::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
overrideprotectedinherited

Definition at line 61 of file RectangleBaseView.cpp.

62 {
64  IShape2DView::mouseReleaseEvent(event);
65 }

References RectangleBaseView::onSizeHandleElementRequest().

Here is the call graph for this function:

◆ onChangedX

void RectangleView::onChangedX ( )
overrideprotectedslot

Definition at line 43 of file RectangleView.cpp.

44 {
45  setBlockOnProperty(true);
46  m_item->setXLow(fromSceneX(this->x()));
47  m_item->setXUp(fromSceneX(this->x() + m_mask_rect.width()));
48  setBlockOnProperty(false);
49 }
void setBlockOnProperty(bool value)
QRectF m_mask_rect
mask rectangle in scene coordinates

References IShape2DView::fromSceneX(), m_item, RectangleBaseView::m_mask_rect, IShape2DView::setBlockOnProperty(), RectangleItem::setXLow(), and RectangleItem::setXUp().

Here is the call graph for this function:

◆ onChangedY

void RectangleView::onChangedY ( )
overrideprotectedslot

Definition at line 51 of file RectangleView.cpp.

52 {
53  setBlockOnProperty(true);
54  m_item->setYLow(fromSceneY(this->y() + m_mask_rect.height()));
55  m_item->setYUp(fromSceneY(this->y()));
56  setBlockOnProperty(false);
57 }

References IShape2DView::fromSceneY(), m_item, RectangleBaseView::m_mask_rect, IShape2DView::setBlockOnProperty(), RectangleItem::setYLow(), and RectangleItem::setYUp().

Here is the call graph for this function:

◆ onItemDestroyed()

void RectangleView::onItemDestroyed ( )
overrideprivatevirtual

Implements IShape2DView.

Definition at line 130 of file RectangleView.cpp.

131 {
132  m_item = nullptr;
133 }

References m_item.

◆ onItemPropertyChange()

void IShape2DView::onItemPropertyChange ( const QString &  propertyName)
privateinherited

Definition at line 151 of file IShape2DView.cpp.

152 {
154  return;
155 
157 
158  bool schedule_update = false;
159  if (MaskItem::isMaskValuePropertyName(propertyName))
160  schedule_update = true;
161  else if (MaskItem::isIsVisiblePropertyName(propertyName)) {
162  bool visible = false;
163  if (auto* maskItem = dynamic_cast<MaskItem*>(parameterizedItem()))
164  visible = maskItem->isVisibleValue();
165  this->setVisible(visible);
166  schedule_update = true;
167  }
168 
170 
171  if (schedule_update)
172  update();
173 
175 }
virtual void onPropertyChange()
Definition: IShape2DView.h:46
virtual SessionItem * parameterizedItem() const =0
A base class for all mask items.
Definition: MaskItems.h:27
static bool isIsVisiblePropertyName(const QString &name)
Definition: MaskItems.cpp:105
static bool isMaskValuePropertyName(const QString &name)
Definition: MaskItems.cpp:90

References MaskItem::isIsVisiblePropertyName(), MaskItem::isMaskValuePropertyName(), IShape2DView::m_block_on_property_change, IShape2DView::onPropertyChange(), and IShape2DView::parameterizedItem().

Referenced by IShape2DView::IShape2DView().

Here is the call graph for this function:

◆ onPropertyChange

void RectangleView::onPropertyChange ( )
overrideprotectedslot

Definition at line 59 of file RectangleView.cpp.

60 {
61  update_view();
62 }

References RectangleBaseView::update_view().

Here is the call graph for this function:

◆ onSizeHandleElementRequest

void RectangleBaseView::onSizeHandleElementRequest ( bool  going_to_resize)
privateslotinherited

triggered by SizeHandleElement

Definition at line 35 of file RectangleBaseView.cpp.

36 {
37  if (going_to_resize) {
38  setFlag(QGraphicsItem::ItemIsMovable, false);
39  m_activeHandleElement = qobject_cast<SizeHandleElement*>(sender());
40  ASSERT(m_activeHandleElement);
41  SizeHandleElement::EHandleLocation oposite_corner =
43  m_resize_opposite_origin = m_resize_handles[oposite_corner]->scenePos();
44  } else {
45  setFlag(QGraphicsItem::ItemIsMovable, true);
46  m_activeHandleElement = nullptr;
47  }
48 }
EHandleLocation getOppositeHandleLocation() const

References SizeHandleElement::getOppositeHandleLocation(), RectangleBaseView::m_activeHandleElement, RectangleBaseView::m_resize_handles, and RectangleBaseView::m_resize_opposite_origin.

Referenced by RectangleBaseView::create_size_handle_elements(), and RectangleBaseView::mouseReleaseEvent().

Here is the call graph for this function:

◆ paint()

void IShape2DView::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  ,
QWidget *   
)
overrideprotectedinherited

Definition at line 70 of file IShape2DView.cpp.

71 {
72  const bool isMasked = itemMaskValue(parameterizedItem());
73  painter->setBrush(MaskEditorHelper::getMaskBrush(isMasked));
74  painter->setPen(MaskEditorHelper::getMaskPen(isMasked));
75  painter->setRenderHints(QPainter::Antialiasing);
76  painter->drawPath(maskedShape());
77 }
QPainterPath maskedShape() const
Returns the shape with all masking already applied.
static QBrush getMaskBrush(bool mask_value)
static QPen getMaskPen(bool mask_value)

References MaskEditorHelper::getMaskBrush(), MaskEditorHelper::getMaskPen(), IShape2DView::maskedShape(), and IShape2DView::parameterizedItem().

Referenced by PolygonView::paint().

Here is the call graph for this function:

◆ parameterizedItem()

SessionItem * RectangleView::parameterizedItem ( ) const
overridevirtual

Implements IShape2DView.

Definition at line 38 of file RectangleView.cpp.

39 {
40  return m_item;
41 }

References m_item.

◆ right()

qreal RectangleView::right ( ) const
overrideprotectedvirtual

Returns the x-coordinate of the rectangle's right edge.

Implements RectangleBaseView.

Definition at line 111 of file RectangleView.cpp.

112 {
113  return toSceneX(m_item->xUp());
114 }
DoubleDescriptor xUp() const
Definition: MaskItems.cpp:168

References m_item, IShape2DView::toSceneX(), and RectangleItem::xUp().

Here is the call graph for this function:

◆ setBlockOnProperty()

void IShape2DView::setBlockOnProperty ( bool  value)
protectedinherited

◆ setSceneAdaptor()

void IShape2DView::setSceneAdaptor ( const ISceneAdaptor adaptor)
inherited

Definition at line 55 of file IShape2DView.cpp.

56 {
57  ASSERT(adaptor);
58 
59  if (m_adaptor != adaptor) {
60  if (m_adaptor)
62 
63  m_adaptor = adaptor;
65  Qt::UniqueConnection);
66  update_view();
67  }
68 }
void update_request()
virtual void update_view()=0
update visual appearance of view (triggered by ISceneAdaptor)

References IShape2DView::m_adaptor, ISceneAdaptor::update_request(), and IShape2DView::update_view().

Referenced by MaskViewFactory::createMaskView().

Here is the call graph for this function:

◆ shape()

QPainterPath RectangleView::shape ( ) const
override

Definition at line 31 of file RectangleView.cpp.

32 {
33  QPainterPath path;
34  path.addRect(m_mask_rect);
35  return path;
36 }

References RectangleBaseView::m_mask_rect.

◆ top()

qreal RectangleView::top ( ) const
overrideprotectedvirtual

Returns the y-coordinate of the rectangle's top edge.

Implements RectangleBaseView.

Definition at line 118 of file RectangleView.cpp.

119 {
120  return toSceneY(m_item->yUp());
121 }
DoubleDescriptor yUp() const
Definition: MaskItems.cpp:178

References m_item, IShape2DView::toSceneY(), and RectangleItem::yUp().

Here is the call graph for this function:

◆ toSceneX()

qreal IShape2DView::toSceneX ( qreal  value) const
protectedinherited

Definition at line 109 of file IShape2DView.cpp.

110 {
111  return m_adaptor ? m_adaptor->toSceneX(value) : value;
112 }
virtual qreal toSceneX(qreal) const =0
convert native mask x-coordinate to scene coordinate

References IShape2DView::m_adaptor, and ISceneAdaptor::toSceneX().

Referenced by EllipseView::left(), left(), EllipseView::onPropertyChange(), VerticalLineView::onPropertyChange(), EllipseView::right(), right(), PolygonView::update_polygon(), EllipseView::update_position(), update_position(), and VerticalLineView::update_view().

Here is the call graph for this function:

◆ toSceneY()

qreal IShape2DView::toSceneY ( qreal  value) const
protectedinherited

Definition at line 114 of file IShape2DView.cpp.

115 {
116  return m_adaptor ? m_adaptor->toSceneY(value) : value;
117 }
virtual qreal toSceneY(qreal) const =0
convert native mask y-coordinate to scene coordinate

References IShape2DView::m_adaptor, and ISceneAdaptor::toSceneY().

Referenced by EllipseView::bottom(), bottom(), EllipseView::onPropertyChange(), HorizontalLineView::onPropertyChange(), EllipseView::top(), top(), PolygonView::update_polygon(), EllipseView::update_position(), update_position(), and HorizontalLineView::update_view().

Here is the call graph for this function:

◆ type()

int RectangleView::type ( ) const
inlineoverride

Definition at line 29 of file RectangleView.h.

References MaskEditorHelper::RECTANGLE.

◆ update_bounding_rect()

void RectangleBaseView::update_bounding_rect ( )
protectedvirtualinherited

updates view's bounding rectangle using item properties

Definition at line 76 of file RectangleBaseView.cpp.

77 {
78  if (parameterizedItem()) {
81  m_bounding_rect = m_mask_rect.marginsAdded(
82  QMarginsF(bbox_margins, bbox_margins, bbox_margins, bbox_margins));
83  }
84  for (QMap<SizeHandleElement::EHandleLocation, SizeHandleElement*>::iterator it =
85  m_resize_handles.begin();
86  it != m_resize_handles.end(); ++it) {
87  it.value()->updateHandleElementPosition(m_mask_rect);
88  }
89 }
virtual QRectF mask_rectangle()=0
int type() const override

References IShape2DView::m_bounding_rect, RectangleBaseView::m_mask_rect, RectangleBaseView::m_resize_handles, RectangleBaseView::mask_rectangle(), IShape2DView::parameterizedItem(), MaskEditorHelper::REGIONOFINTEREST, and RectangleBaseView::type().

Referenced by RectangleBaseView::update_view().

Here is the call graph for this function:

◆ update_position()

void RectangleView::update_position ( )
overrideprotectedvirtual

updates position of view using item properties

Implements RectangleBaseView.

Definition at line 91 of file RectangleView.cpp.

92 {
93  setX(toSceneX(m_item->xLow()));
94  setY(toSceneY(m_item->yUp()));
95 }

References m_item, IShape2DView::toSceneX(), IShape2DView::toSceneY(), RectangleItem::xLow(), and RectangleItem::yUp().

Here is the call graph for this function:

◆ update_view()

void RectangleBaseView::update_view ( )
overrideprotectedvirtualinherited

update visual appearance of view (triggered by ISceneAdaptor)

Implements IShape2DView.

Definition at line 67 of file RectangleBaseView.cpp.

68 {
69  prepareGeometryChange();
72 }
virtual void update_position()=0
virtual void update_bounding_rect()
updates view's bounding rectangle using item properties

References RectangleBaseView::update_bounding_rect(), and RectangleBaseView::update_position().

Referenced by mouseMoveEvent(), EllipseView::onPropertyChange(), onPropertyChange(), and RegionOfInterestView::update_view().

Here is the call graph for this function:

◆ width()

qreal RectangleBaseView::width ( ) const
protectedinherited

Returns width of the rectangle.

Definition at line 93 of file RectangleBaseView.cpp.

94 {
95  return right() - left();
96 }
virtual qreal right() const =0
virtual qreal left() const =0

References RectangleBaseView::left(), and RectangleBaseView::right().

Referenced by EllipseView::mask_rectangle(), mask_rectangle(), and EllipseView::mouseMoveEvent().

Here is the call graph for this function:

Member Data Documentation

◆ m_activeHandleElement

SizeHandleElement* RectangleBaseView::m_activeHandleElement
protectedinherited

◆ m_adaptor

◆ m_block_on_property_change

bool IShape2DView::m_block_on_property_change
protectedinherited

◆ m_bounding_rect

◆ m_item

◆ m_mask_rect

QRectF RectangleBaseView::m_mask_rect
protectedinherited

mask rectangle in scene coordinates

Definition at line 52 of file RectangleBaseView.h.

Referenced by onChangedX(), onChangedY(), RegionOfInterestView::paint(), EllipseView::shape(), shape(), and RectangleBaseView::update_bounding_rect().

◆ m_resize_handles

QMap<SizeHandleElement::EHandleLocation, SizeHandleElement*> RectangleBaseView::m_resize_handles
protectedinherited

coordinates of corner opposite to the grip corner at the moment it first clicked in scene coordinates

Definition at line 53 of file RectangleBaseView.h.

Referenced by RectangleBaseView::create_size_handle_elements(), RectangleBaseView::itemChange(), RectangleBaseView::onSizeHandleElementRequest(), and RectangleBaseView::update_bounding_rect().

◆ m_resize_opposite_origin

QPointF RectangleBaseView::m_resize_opposite_origin
protectedinherited

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