BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
MaskGraphicsScene Class Reference

Graphics scene for MaskEditorCanvas to draw masks on top of intensity data widgets. More...

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

Public Slots

void cancelCurrentDrawing ()
 
void onActivityModeChanged (MaskEditorFlags::Activity value)
 
void onMaskValueChanged (MaskEditorFlags::MaskValue value)
 
void onRowsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 
void onRowsInserted (const QModelIndex &, int, int)
 
void onRowsRemoved (const QModelIndex &, int, int)
 
void resetScene ()
 
void updateScene ()
 Main method to update scene on various changes in the model. More...
 

Signals

void itemContextMenuRequest (const QPoint &point)
 

Public Member Functions

 MaskGraphicsScene (QObject *parent=0)
 
 ~MaskGraphicsScene ()
 
ColorMapcolorMap ()
 
void resetContext ()
 
void setMaskContext (SessionModel *model, const QModelIndex &maskContainerIndex, IntensityDataItem *intensityItem)
 
void setSelectionModel (QItemSelectionModel *model)
 

Protected Member Functions

void contextMenuEvent (QGraphicsSceneContextMenuEvent *event)
 Creates item context menu if there is IMaskView beneath the mouse right click. More...
 
void drawForeground (QPainter *painter, const QRectF &rect)
 Draws dashed line to the current mouse position in the case of ungoing line or polygon drawing. More...
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
 
void mousePressEvent (QGraphicsSceneMouseEvent *event)
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 Finalizes item drawing or pass events to other items. More...
 

Private Slots

void onSceneSelectionChanged ()
 Propagates selection from scene to model. More...
 
void onSessionSelectionChanged (const QItemSelection &, const QItemSelection &)
 Propagates selection from model to scene. More...
 

Private Member Functions

IShape2DViewaddViewForItem (SessionItem *item)
 Creates a view for given item. More...
 
PolygonViewcurrentPolygon () const
 Returns polygon which is currently under the drawing. More...
 
void deleteViews (const QModelIndex &itemIndex)
 Recursive delete of all views corresponding to given index. More...
 
bool isAreaContains (QGraphicsSceneMouseEvent *event, MaskEditorHelper::EViewTypes viewType)
 Return true if area beneath the mouse contains views of given type. More...
 
bool isDrawingInProgress () const
 
bool isValidForLineDrawing (QGraphicsSceneMouseEvent *event)
 Returns true if mouse click is in context suitable for line drawing. More...
 
bool isValidForMaskAllDrawing (QGraphicsSceneMouseEvent *event)
 Returns true if MaskAllItem can be drawn. Only one item of such type is allowed. More...
 
bool isValidForPolygonDrawing (QGraphicsSceneMouseEvent *event)
 Returns true if mouse click is in context suitable for polygon drawing. More...
 
bool isValidForRectangleShapeDrawing (QGraphicsSceneMouseEvent *event)
 Returns true if mouse click is valid for rectangular/elliptic/ROI shapes. More...
 
bool isValidMouseClick (QGraphicsSceneMouseEvent *event)
 Returns true if left mouse bottom click was inside ColorMap viewport rectangle. More...
 
void makeViewAtMousePosSelected (QGraphicsSceneMouseEvent *event)
 
void processHorizontalLineItem (const QPointF &pos)
 
void processLineItem (QGraphicsSceneMouseEvent *event)
 
void processMaskAllItem (QGraphicsSceneMouseEvent *event)
 
void processPolygonItem (QGraphicsSceneMouseEvent *event)
 
void processRectangleShapeItem (QGraphicsSceneMouseEvent *event)
 Processes RectangleItem and EllipseItem drawing If the mouse move distance with left button down is larger than certain threshold, new item will be created. More...
 
void processVerticalLineItem (const QPointF &pos)
 
void removeItemViewFromScene (SessionItem *item)
 Removes single view from scene. More...
 
void setDrawingInProgress (bool value)
 
void setInPanAndZoomMode (bool value)
 Sets the state of all views in pan&zoom mode. More...
 
void setItemName (SessionItem *itemToChange)
 Sets item name depending on alreay existent items. More...
 
void setZValues ()
 Update Z-values of all IMaskView to reflect stacking order in SessionModel. More...
 
void updateCursors ()
 Change cursor to stress that hovered item is movable (when not in PanZoom mode) More...
 
void updateProxyWidget ()
 Updates proxy widget for intensity data item. More...
 
void updateViews (const QModelIndex &parentIndex={}, IShape2DView *parentView=0)
 Recutsively runs through the model and creates corresponding views. More...
 

Private Attributes

QSharedPointer< ISceneAdaptorm_adaptor
 
bool m_block_selection
 
MaskDrawingContext m_context
 
SessionItemm_currentItem
 
QPointF m_currentMousePosition
 
IntensityDataItemm_intensityItem
 
QMap< SessionItem *, IShape2DView * > m_ItemToView
 
QModelIndex m_maskContainerIndex
 
SessionModelm_maskModel
 
MaskGraphicsProxym_proxy
 
QItemSelectionModel * m_selectionModel
 

Detailed Description

Graphics scene for MaskEditorCanvas to draw masks on top of intensity data widgets.

Definition at line 41 of file MaskGraphicsScene.h.

Constructor & Destructor Documentation

◆ MaskGraphicsScene()

MaskGraphicsScene::MaskGraphicsScene ( QObject *  parent = 0)

Definition at line 35 of file MaskGraphicsScene.cpp.

36  : QGraphicsScene(parent)
37  , m_maskModel(0)
38  , m_selectionModel(0)
39  , m_proxy(0)
40  , m_block_selection(false)
41  , m_intensityItem(0)
42  , m_currentItem(0)
43 {
44  setSceneRect(default_scene_rect);
45  connect(this, &MaskGraphicsScene::selectionChanged, this,
47 }
SessionModel * m_maskModel
QItemSelectionModel * m_selectionModel
IntensityDataItem * m_intensityItem
MaskGraphicsProxy * m_proxy
void onSceneSelectionChanged()
Propagates selection from scene to model.
SessionItem * m_currentItem

References onSceneSelectionChanged().

Here is the call graph for this function:

◆ ~MaskGraphicsScene()

MaskGraphicsScene::~MaskGraphicsScene ( )

Definition at line 49 of file MaskGraphicsScene.cpp.

50 {
51  // Fix within #1792
52  if (m_proxy)
54 }
void setSceneAdaptor(ISceneAdaptor *sceneAdaptor)

References m_proxy, and MaskGraphicsProxy::setSceneAdaptor().

Here is the call graph for this function:

Member Function Documentation

◆ addViewForItem()

IShape2DView * MaskGraphicsScene::addViewForItem ( SessionItem item)
private

Creates a view for given item.

Definition at line 401 of file MaskGraphicsScene.cpp.

402 {
403  ASSERT(item);
404  IShape2DView* view = m_ItemToView[item];
405  if (!view) {
406  view = MaskViewFactory::createMaskView(item, m_adaptor.data());
407  if (view) {
408  m_ItemToView[item] = view;
409  addItem(view);
410  return view;
411  }
412  }
413  return view;
414 }
#define ASSERT(condition)
Definition: Assert.h:31
Main interface class for views representing MaskItems, Projections on graphics scene.
Definition: IShape2DView.h:27
QMap< SessionItem *, IShape2DView * > m_ItemToView
QSharedPointer< ISceneAdaptor > m_adaptor
static IShape2DView * createMaskView(SessionItem *item, ISceneAdaptor *adaptor=0)

References ASSERT, MaskViewFactory::createMaskView(), m_adaptor, and m_ItemToView.

Referenced by updateScene(), and updateViews().

Here is the call graph for this function:

◆ cancelCurrentDrawing

void MaskGraphicsScene::cancelCurrentDrawing ( )
slot

Definition at line 174 of file MaskGraphicsScene.cpp.

175 {
176  if (isDrawingInProgress()) {
178  QModelIndex index = m_maskModel->indexOfItem(m_currentItem);
179  m_maskModel->removeRows(index.row(), 1, index.parent());
180  setDrawingInProgress(false);
181  }
182 }
void setDrawingInProgress(bool value)
bool isDrawingInProgress() const
virtual bool removeRows(int row, int count, const QModelIndex &parent)
QModelIndex indexOfItem(SessionItem *item) const

References ASSERT, SessionModel::indexOfItem(), isDrawingInProgress(), m_currentItem, m_maskModel, SessionModel::removeRows(), and setDrawingInProgress().

Referenced by MaskGraphicsView::cancelCurrentDrawing(), mousePressEvent(), and onActivityModeChanged().

Here is the call graph for this function:

◆ colorMap()

ColorMap * MaskGraphicsScene::colorMap ( )

Definition at line 129 of file MaskGraphicsScene.cpp.

130 {
131  ASSERT(m_proxy);
132  return m_proxy->colorMap();
133 }

References ASSERT, MaskGraphicsProxy::colorMap(), and m_proxy.

Referenced by MaskEditorCanvas::onSavePlotRequest(), ProjectionsEditorCanvas::setContext(), and MaskEditorCanvas::setMaskContext().

Here is the call graph for this function:

◆ contextMenuEvent()

void MaskGraphicsScene::contextMenuEvent ( QGraphicsSceneContextMenuEvent *  event)
protected

Creates item context menu if there is IMaskView beneath the mouse right click.

Definition at line 355 of file MaskGraphicsScene.cpp.

356 {
357  if (isDrawingInProgress())
358  return;
359 
360  if (dynamic_cast<IShape2DView*>(itemAt(event->scenePos(), QTransform())))
361  emit itemContextMenuRequest(event->screenPos());
362 }
void itemContextMenuRequest(const QPoint &point)

References isDrawingInProgress(), and itemContextMenuRequest().

Here is the call graph for this function:

◆ currentPolygon()

PolygonView * MaskGraphicsScene::currentPolygon ( ) const
private

Returns polygon which is currently under the drawing.

Definition at line 721 of file MaskGraphicsScene.cpp.

722 {
723  PolygonView* result(0);
725  if (m_currentItem)
726  result = dynamic_cast<PolygonView*>(m_ItemToView[m_currentItem]);
727  }
728  return result;
729 }
MaskDrawingContext m_context
This is a View of polygon mask (represented by PolygonItem) on GraphicsScene.
Definition: PolygonView.h:23

References isDrawingInProgress(), MaskDrawingContext::isPolygonMode(), m_context, m_currentItem, and m_ItemToView.

Referenced by drawForeground(), and processPolygonItem().

Here is the call graph for this function:

◆ deleteViews()

void MaskGraphicsScene::deleteViews ( const QModelIndex &  itemIndex)
private

Recursive delete of all views corresponding to given index.

Definition at line 418 of file MaskGraphicsScene.cpp.

419 {
420  for (int i_row = 0; i_row < m_maskModel->rowCount(parentIndex); ++i_row) {
421  QModelIndex itemIndex = m_maskModel->index(i_row, 0, parentIndex);
422 
423  if (SessionItem* item = m_maskModel->itemForIndex(itemIndex))
425 
426  deleteViews(itemIndex);
427  }
428  removeItemViewFromScene(m_maskModel->itemForIndex(parentIndex)); // deleting parent item
429 }
void deleteViews(const QModelIndex &itemIndex)
Recursive delete of all views corresponding to given index.
void removeItemViewFromScene(SessionItem *item)
Removes single view from scene.
SessionItem * itemForIndex(const QModelIndex &index) const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
virtual int rowCount(const QModelIndex &parent) const

References SessionModel::index(), SessionModel::itemForIndex(), m_maskModel, removeItemViewFromScene(), and SessionModel::rowCount().

Referenced by onRowsAboutToBeRemoved().

Here is the call graph for this function:

◆ drawForeground()

void MaskGraphicsScene::drawForeground ( QPainter *  painter,
const QRectF &  rect 
)
protected

Draws dashed line to the current mouse position in the case of ungoing line or polygon drawing.

Definition at line 321 of file MaskGraphicsScene.cpp.

322 {
323  // if(!isDrawingInProgress())
324  // return;
325 
326  if (m_currentMousePosition == QPointF())
327  return;
328 
329  if (PolygonView* polygon = currentPolygon()) {
330  painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
331  painter->drawLine(QLineF(polygon->lastAddedPoint(), m_currentMousePosition));
332  } else {
333  if (m_context.isLineMode()) {
334  const QRectF& plot_scene_rectangle = m_adaptor->viewportRectangle();
335  if (!plot_scene_rectangle.contains(m_currentMousePosition))
336  return;
337 
338  painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
340  QPointF p1(m_currentMousePosition.x(), plot_scene_rectangle.bottom());
341  QPointF p2(m_currentMousePosition.x(), plot_scene_rectangle.top());
342  painter->drawLine(QLineF(p1, p2));
343  }
345  QPointF p1(plot_scene_rectangle.left(), m_currentMousePosition.y());
346  QPointF p2(plot_scene_rectangle.right(), m_currentMousePosition.y());
347  painter->drawLine(QLineF(p1, p2));
348  }
349  }
350  }
351 }
bool isVerticalLineMode() const
bool isHorizontalLineMode() const
PolygonView * currentPolygon() const
Returns polygon which is currently under the drawing.

References currentPolygon(), MaskDrawingContext::isHorizontalLineMode(), MaskDrawingContext::isLineMode(), MaskDrawingContext::isVerticalLineMode(), m_adaptor, m_context, and m_currentMousePosition.

Here is the call graph for this function:

◆ isAreaContains()

bool MaskGraphicsScene::isAreaContains ( QGraphicsSceneMouseEvent *  event,
MaskEditorHelper::EViewTypes  viewType 
)
private

Return true if area beneath the mouse contains views of given type.

Definition at line 531 of file MaskGraphicsScene.cpp.

533 {
534  for (QGraphicsItem* graphicsItem : this->items(event->scenePos()))
535  if (graphicsItem->type() == viewType)
536  return true;
537  return false;
538 }

Referenced by isValidForPolygonDrawing(), and isValidForRectangleShapeDrawing().

◆ isDrawingInProgress()

bool MaskGraphicsScene::isDrawingInProgress ( ) const
private

Definition at line 540 of file MaskGraphicsScene.cpp.

541 {
543 }
bool isDrawingInProgress() const

References MaskDrawingContext::isDrawingInProgress(), and m_context.

Referenced by cancelCurrentDrawing(), contextMenuEvent(), currentPolygon(), isValidForLineDrawing(), isValidForMaskAllDrawing(), isValidForPolygonDrawing(), isValidForRectangleShapeDrawing(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and processRectangleShapeItem().

Here is the call graph for this function:

◆ isValidForLineDrawing()

bool MaskGraphicsScene::isValidForLineDrawing ( QGraphicsSceneMouseEvent *  event)
private

Returns true if mouse click is in context suitable for line drawing.

Definition at line 497 of file MaskGraphicsScene.cpp.

498 {
499  if (!isValidMouseClick(event))
500  return false;
501  if (isDrawingInProgress())
502  return false;
503  if (!m_context.isLineMode())
504  return false;
505  if (QGraphicsItem* graphicsItem = itemAt(event->scenePos(), QTransform())) {
506  if (graphicsItem->type() == MaskEditorHelper::VERTICALLINE
507  || graphicsItem->type() == MaskEditorHelper::HORIZONTALLINE)
508  return false;
509  }
510  return true;
511 }
bool isValidMouseClick(QGraphicsSceneMouseEvent *event)
Returns true if left mouse bottom click was inside ColorMap viewport rectangle.

References MaskEditorHelper::HORIZONTALLINE, isDrawingInProgress(), MaskDrawingContext::isLineMode(), isValidMouseClick(), m_context, and MaskEditorHelper::VERTICALLINE.

Referenced by mousePressEvent().

Here is the call graph for this function:

◆ isValidForMaskAllDrawing()

bool MaskGraphicsScene::isValidForMaskAllDrawing ( QGraphicsSceneMouseEvent *  event)
private

Returns true if MaskAllItem can be drawn. Only one item of such type is allowed.

Definition at line 515 of file MaskGraphicsScene.cpp.

516 {
517  if (!isValidMouseClick(event))
518  return false;
519  if (isDrawingInProgress())
520  return false;
521  if (!m_context.isMaskAllMode())
522  return false;
523  for (SessionItem* item : m_ItemToView.keys())
524  if (item->modelType() == "MaskAllMask")
525  return false;
526  return true;
527 }

References isDrawingInProgress(), MaskDrawingContext::isMaskAllMode(), isValidMouseClick(), m_context, and m_ItemToView.

Referenced by mousePressEvent().

Here is the call graph for this function:

◆ isValidForPolygonDrawing()

bool MaskGraphicsScene::isValidForPolygonDrawing ( QGraphicsSceneMouseEvent *  event)
private

Returns true if mouse click is in context suitable for polygon drawing.

Definition at line 482 of file MaskGraphicsScene.cpp.

483 {
484  if (!isValidMouseClick(event))
485  return false;
486  if (!m_context.isPolygonMode())
487  return false;
488  if (!isDrawingInProgress()) {
490  return false;
491  }
492  return true;
493 }
bool isAreaContains(QGraphicsSceneMouseEvent *event, MaskEditorHelper::EViewTypes viewType)
Return true if area beneath the mouse contains views of given type.

References isAreaContains(), isDrawingInProgress(), MaskDrawingContext::isPolygonMode(), isValidMouseClick(), m_context, and MaskEditorHelper::POLYGONPOINT.

Referenced by mousePressEvent().

Here is the call graph for this function:

◆ isValidForRectangleShapeDrawing()

bool MaskGraphicsScene::isValidForRectangleShapeDrawing ( QGraphicsSceneMouseEvent *  event)
private

Returns true if mouse click is valid for rectangular/elliptic/ROI shapes.

Definition at line 461 of file MaskGraphicsScene.cpp.

462 {
463  if (isDrawingInProgress())
464  return false;
465  if (!isValidMouseClick(event))
466  return false;
468  return false;
470  return false;
471  if (m_context.isROIMode()) {
472  // only one ROI is allowed
473  for (SessionItem* item : m_ItemToView.keys())
474  if (item->modelType() == "RegionOfInterest")
475  return false;
476  }
477  return true;
478 }
bool isRectangleShapeMode() const

References isAreaContains(), isDrawingInProgress(), MaskDrawingContext::isRectangleShapeMode(), MaskDrawingContext::isROIMode(), isValidMouseClick(), m_context, m_ItemToView, and MaskEditorHelper::SIZEHANDLE.

Referenced by mousePressEvent().

Here is the call graph for this function:

◆ isValidMouseClick()

bool MaskGraphicsScene::isValidMouseClick ( QGraphicsSceneMouseEvent *  event)
private

Returns true if left mouse bottom click was inside ColorMap viewport rectangle.

Definition at line 448 of file MaskGraphicsScene.cpp.

449 {
450  if (!m_adaptor)
451  return false;
452  if (!(event->buttons() & Qt::LeftButton))
453  return false;
454  if (!m_adaptor->viewportRectangle().contains(event->scenePos()))
455  return false;
456  return true;
457 }

References m_adaptor.

Referenced by isValidForLineDrawing(), isValidForMaskAllDrawing(), isValidForPolygonDrawing(), and isValidForRectangleShapeDrawing().

◆ itemContextMenuRequest

void MaskGraphicsScene::itemContextMenuRequest ( const QPoint &  point)
signal

◆ makeViewAtMousePosSelected()

void MaskGraphicsScene::makeViewAtMousePosSelected ( QGraphicsSceneMouseEvent *  event)
private

Definition at line 581 of file MaskGraphicsScene.cpp.

582 {
583  if (QGraphicsItem* graphicsItem = itemAt(event->scenePos(), QTransform()))
584  graphicsItem->setSelected(true);
585 }

Referenced by mousePressEvent(), and mouseReleaseEvent().

◆ mouseMoveEvent()

void MaskGraphicsScene::mouseMoveEvent ( QGraphicsSceneMouseEvent *  event)
protected

Definition at line 280 of file MaskGraphicsScene.cpp.

281 {
284  return;
285  }
286  QGraphicsScene::mouseMoveEvent(event);
287 
289  m_currentMousePosition = event->scenePos();
290  invalidate();
291  }
292 }
void processRectangleShapeItem(QGraphicsSceneMouseEvent *event)
Processes RectangleItem and EllipseItem drawing If the mouse move distance with left button down is l...

References isDrawingInProgress(), MaskDrawingContext::isLineMode(), MaskDrawingContext::isPolygonMode(), MaskDrawingContext::isRectangleShapeMode(), m_context, m_currentMousePosition, and processRectangleShapeItem().

Here is the call graph for this function:

◆ mousePressEvent()

void MaskGraphicsScene::mousePressEvent ( QGraphicsSceneMouseEvent *  event)
protected

Definition at line 251 of file MaskGraphicsScene.cpp.

252 {
253  if (event->buttons() & Qt::RightButton) {
254  if (isDrawingInProgress()) {
256  } else {
258  }
259  return;
260  }
261  if (isValidForPolygonDrawing(event)) {
262  processPolygonItem(event);
263  return;
264  }
265  if (isValidForLineDrawing(event)) {
266  processLineItem(event);
267  return;
268  }
269  if (isValidForMaskAllDrawing(event)) {
270  processMaskAllItem(event);
271  return;
272  }
273  if (isValidForRectangleShapeDrawing(event)) {
275  return;
276  }
277  QGraphicsScene::mousePressEvent(event);
278 }
void processLineItem(QGraphicsSceneMouseEvent *event)
void processPolygonItem(QGraphicsSceneMouseEvent *event)
void processMaskAllItem(QGraphicsSceneMouseEvent *event)
bool isValidForMaskAllDrawing(QGraphicsSceneMouseEvent *event)
Returns true if MaskAllItem can be drawn. Only one item of such type is allowed.
bool isValidForRectangleShapeDrawing(QGraphicsSceneMouseEvent *event)
Returns true if mouse click is valid for rectangular/elliptic/ROI shapes.
bool isValidForPolygonDrawing(QGraphicsSceneMouseEvent *event)
Returns true if mouse click is in context suitable for polygon drawing.
bool isValidForLineDrawing(QGraphicsSceneMouseEvent *event)
Returns true if mouse click is in context suitable for line drawing.
void makeViewAtMousePosSelected(QGraphicsSceneMouseEvent *event)

References cancelCurrentDrawing(), isDrawingInProgress(), isValidForLineDrawing(), isValidForMaskAllDrawing(), isValidForPolygonDrawing(), isValidForRectangleShapeDrawing(), makeViewAtMousePosSelected(), processLineItem(), processMaskAllItem(), processPolygonItem(), and processRectangleShapeItem().

Here is the call graph for this function:

◆ mouseReleaseEvent()

void MaskGraphicsScene::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
protected

Finalizes item drawing or pass events to other items.

Definition at line 296 of file MaskGraphicsScene.cpp.

297 {
298  if (isDrawingInProgress()) {
300  clearSelection();
301  if (m_currentItem) {
302  // drawing ended up with item drawn, let's make it selected
303  if (IShape2DView* view = m_ItemToView[m_currentItem]) {
304  view->setSelected(true);
305  }
306  } else {
307  // drawing ended without item to be draw (too short mouse move)
308  // making item beneath of mouse release position to be selected
310  }
311  setDrawingInProgress(false);
312  }
313  } else {
314  QGraphicsScene::mouseReleaseEvent(event);
315  }
316 }

References isDrawingInProgress(), MaskDrawingContext::isRectangleShapeMode(), m_context, m_currentItem, m_ItemToView, makeViewAtMousePosSelected(), and setDrawingInProgress().

Here is the call graph for this function:

◆ onActivityModeChanged

void MaskGraphicsScene::onActivityModeChanged ( MaskEditorFlags::Activity  value)
slot

Definition at line 135 of file MaskGraphicsScene.cpp.

136 {
137  if (!m_proxy)
138  return;
139 
142 
143  m_context.setActivityType(value);
145 
146  updateCursors();
147 }
void setActivityType(MaskEditorFlags::Activity value)
bool isActivityRequiresDrawingCancel(MaskEditorFlags::Activity proposed_new_activity)
return true, if proposed activity requires the cancel of drawing i.e.
void setInPanAndZoomMode(bool value)
Sets the state of all views in pan&zoom mode.
void updateCursors()
Change cursor to stress that hovered item is movable (when not in PanZoom mode)

References cancelCurrentDrawing(), MaskDrawingContext::isActivityRequiresDrawingCancel(), MaskDrawingContext::isInZoomMode(), m_context, m_proxy, MaskDrawingContext::setActivityType(), setInPanAndZoomMode(), and updateCursors().

Referenced by ProjectionsEditorCanvas::onActivityModeChanged(), ProjectionsEditorCanvas::setContext(), and MaskEditor::setup_connections().

Here is the call graph for this function:

◆ onMaskValueChanged

void MaskGraphicsScene::onMaskValueChanged ( MaskEditorFlags::MaskValue  value)
slot

Definition at line 149 of file MaskGraphicsScene.cpp.

150 {
151  m_context.setMaskValue(value);
152 }
void setMaskValue(MaskEditorFlags::MaskValue value)

References m_context, and MaskDrawingContext::setMaskValue().

Referenced by MaskEditor::setup_connections().

Here is the call graph for this function:

◆ onRowsAboutToBeRemoved

void MaskGraphicsScene::onRowsAboutToBeRemoved ( const QModelIndex &  parent,
int  first,
int  last 
)
slot

Definition at line 159 of file MaskGraphicsScene.cpp.

160 {
161  m_block_selection = true;
162  for (int irow = first; irow <= last; ++irow) {
163  QModelIndex itemIndex = m_maskModel->index(irow, 0, parent);
164  deleteViews(itemIndex); // deleting all child items
165  }
166  m_block_selection = false;
167 }

References deleteViews(), SessionModel::index(), m_block_selection, and m_maskModel.

Referenced by resetContext(), and setMaskContext().

Here is the call graph for this function:

◆ onRowsInserted

void MaskGraphicsScene::onRowsInserted ( const QModelIndex &  ,
int  ,
int   
)
slot

Definition at line 154 of file MaskGraphicsScene.cpp.

155 {
156  updateScene();
157 }
void updateScene()
Main method to update scene on various changes in the model.

References updateScene().

Referenced by resetContext(), and setMaskContext().

Here is the call graph for this function:

◆ onRowsRemoved

void MaskGraphicsScene::onRowsRemoved ( const QModelIndex &  ,
int  ,
int   
)
slot

Definition at line 169 of file MaskGraphicsScene.cpp.

170 {
171  updateScene();
172 }

References updateScene().

Referenced by resetContext(), and setMaskContext().

Here is the call graph for this function:

◆ onSceneSelectionChanged

void MaskGraphicsScene::onSceneSelectionChanged ( )
privateslot

Propagates selection from scene to model.

Definition at line 231 of file MaskGraphicsScene.cpp.

232 {
233  if (m_block_selection)
234  return;
235 
236  m_block_selection = true;
237 
238  m_selectionModel->clearSelection();
239 
240  for (QGraphicsItem* graphicsItem : selectedItems()) {
241  if (IShape2DView* view = dynamic_cast<IShape2DView*>(graphicsItem)) {
242  QModelIndex itemIndex = m_maskModel->indexOfItem(view->parameterizedItem());
243  ASSERT(itemIndex.isValid());
244  if (!m_selectionModel->isSelected(itemIndex))
245  m_selectionModel->select(itemIndex, QItemSelectionModel::Select);
246  }
247  }
248  m_block_selection = false;
249 }

References ASSERT, SessionModel::indexOfItem(), m_block_selection, m_maskModel, and m_selectionModel.

Referenced by MaskGraphicsScene().

Here is the call graph for this function:

◆ onSessionSelectionChanged

void MaskGraphicsScene::onSessionSelectionChanged ( const QItemSelection &  ,
const QItemSelection &   
)
privateslot

Propagates selection from model to scene.

Definition at line 214 of file MaskGraphicsScene.cpp.

215 {
216  if (m_block_selection)
217  return;
218 
219  m_block_selection = true;
220 
221  for (auto it = m_ItemToView.begin(); it != m_ItemToView.end(); ++it) {
222  QModelIndex index = m_maskModel->indexOfItem(it.key());
223  if (index.isValid())
224  it.value()->setSelected(m_selectionModel->isSelected(index));
225  }
226  m_block_selection = false;
227 }

References SessionModel::indexOfItem(), m_block_selection, m_ItemToView, m_maskModel, and m_selectionModel.

Referenced by setSelectionModel().

Here is the call graph for this function:

◆ processHorizontalLineItem()

void MaskGraphicsScene::processHorizontalLineItem ( const QPointF &  pos)
private

Definition at line 690 of file MaskGraphicsScene.cpp.

691 {
694 }
static const QString P_POSY
Definition: MaskItems.h:81
QModelIndex m_maskContainerIndex
void setItemValue(const QString &tag, const QVariant &variant)
Directly set value of item under given tag.
T * insertItem(SessionItem *parent=nullptr, int row=-1, QString tag="")
Definition: SessionModel.h:125

References SessionModel::insertItem(), m_adaptor, m_currentItem, m_maskContainerIndex, m_maskModel, HorizontalLineItem::P_POSY, and SessionItem::setItemValue().

Referenced by processLineItem().

Here is the call graph for this function:

◆ processLineItem()

void MaskGraphicsScene::processLineItem ( QGraphicsSceneMouseEvent *  event)
private

Definition at line 665 of file MaskGraphicsScene.cpp.

666 {
667  setDrawingInProgress(true);
668  QPointF click_pos = event->buttonDownScenePos(Qt::LeftButton);
669 
671  processVerticalLineItem(click_pos);
672 
674  processHorizontalLineItem(click_pos);
675 
676  m_selectionModel->clearSelection();
677  m_selectionModel->select(m_maskModel->indexOfItem(m_currentItem), QItemSelectionModel::Select);
680 
681  setDrawingInProgress(false);
682 }
void processVerticalLineItem(const QPointF &pos)
void processHorizontalLineItem(const QPointF &pos)
void setItemName(SessionItem *itemToChange)
Sets item name depending on alreay existent items.
static const QString P_MASK_VALUE
Definition: MaskItems.h:33

References MaskDrawingContext::getMaskValue(), SessionModel::indexOfItem(), MaskDrawingContext::isHorizontalLineMode(), MaskDrawingContext::isVerticalLineMode(), m_context, m_currentItem, m_maskModel, m_selectionModel, MaskItem::P_MASK_VALUE, processHorizontalLineItem(), processVerticalLineItem(), setDrawingInProgress(), setItemName(), and SessionItem::setItemValue().

Referenced by mousePressEvent().

Here is the call graph for this function:

◆ processMaskAllItem()

void MaskGraphicsScene::processMaskAllItem ( QGraphicsSceneMouseEvent *  event)
private

Definition at line 696 of file MaskGraphicsScene.cpp.

697 {
698  Q_UNUSED(event);
699  setDrawingInProgress(true);
701  m_selectionModel->clearSelection();
702  setDrawingInProgress(false);
703 }

References SessionModel::insertItem(), m_currentItem, m_maskContainerIndex, m_maskModel, m_selectionModel, and setDrawingInProgress().

Referenced by mousePressEvent().

Here is the call graph for this function:

◆ processPolygonItem()

void MaskGraphicsScene::processPolygonItem ( QGraphicsSceneMouseEvent *  event)
private

Definition at line 636 of file MaskGraphicsScene.cpp.

637 {
639 
640  if (!m_currentItem) {
641  setDrawingInProgress(true);
644  m_selectionModel->clearSelection();
646  QItemSelectionModel::Select);
648  }
649  ASSERT(m_currentItem->modelType() == "PolygonMask");
650 
651  if (PolygonView* polygon = currentPolygon()) {
652  if (polygon->closePolygonIfNecessary()) {
653  setDrawingInProgress(false);
655  return;
656  }
657  }
659  QPointF click_pos = event->buttonDownScenePos(Qt::LeftButton);
660 
661  point->setItemValue(PolygonPointItem::P_POSX, m_adaptor->fromSceneX(click_pos.x()));
662  point->setItemValue(PolygonPointItem::P_POSY, m_adaptor->fromSceneY(click_pos.y()));
663 }
static const QString P_POSX
Definition: MaskItems.h:57
static const QString P_POSY
Definition: MaskItems.h:58
QString modelType() const
Get model type.

References ASSERT, currentPolygon(), MaskDrawingContext::getMaskValue(), SessionModel::indexOfItem(), SessionModel::insertItem(), MaskDrawingContext::isPolygonMode(), m_adaptor, m_context, m_currentItem, m_currentMousePosition, m_maskContainerIndex, m_maskModel, m_selectionModel, SessionItem::modelType(), MaskItem::P_MASK_VALUE, PolygonPointItem::P_POSX, PolygonPointItem::P_POSY, setDrawingInProgress(), setItemName(), and SessionItem::setItemValue().

Referenced by mousePressEvent().

Here is the call graph for this function:

◆ processRectangleShapeItem()

void MaskGraphicsScene::processRectangleShapeItem ( QGraphicsSceneMouseEvent *  event)
private

Processes RectangleItem and EllipseItem drawing If the mouse move distance with left button down is larger than certain threshold, new item will be created.

Further, this function will update size and position of current rectangle if mouse keep moving.

Definition at line 592 of file MaskGraphicsScene.cpp.

593 {
594  if (!isDrawingInProgress())
595  setDrawingInProgress(true);
596 
597  QPointF click_pos = event->buttonDownScenePos(Qt::LeftButton);
598  QPointF mouse_pos = event->scenePos();
599  QLineF line(mouse_pos, click_pos);
600 
601  if (!m_currentItem && line.length() > min_distance_to_create_rect) {
604  if (!m_context.isROIMode())
607  }
608  if (!m_currentItem)
609  return;
610 
611  qreal xmin = std::min(click_pos.x(), mouse_pos.x());
612  qreal xmax = std::max(click_pos.x(), mouse_pos.x());
613  qreal ymin = std::min(click_pos.y(), mouse_pos.y());
614  qreal ymax = std::max(click_pos.y(), mouse_pos.y());
615 
616  if (m_currentItem->modelType() == "RectangleMask"
617  || m_currentItem->modelType() == "RegionOfInterest") {
622  } else if (m_currentItem->modelType() == "EllipseMask") {
624  m_adaptor->fromSceneX(xmin + (xmax - xmin) / 2.));
626  m_adaptor->fromSceneY(ymin + (ymax - ymin) / 2.));
628  (m_adaptor->fromSceneX(xmax) - m_adaptor->fromSceneX(xmin))
629  / 2.);
631  (m_adaptor->fromSceneY(ymin) - m_adaptor->fromSceneY(ymax))
632  / 2.);
633  }
634 }
static const QString P_XRADIUS
Definition: MaskItems.h:91
static const QString P_YRADIUS
Definition: MaskItems.h:92
static const QString P_XCENTER
Definition: MaskItems.h:89
static const QString P_YCENTER
Definition: MaskItems.h:90
QString activityToModelType() const
Returns model type corresponding to current activity.
int activityToRow() const
Returns model row corresponding to given activity.
static const QString P_XUP
Definition: MaskItems.h:43
static const QString P_YLOW
Definition: MaskItems.h:42
static const QString P_YUP
Definition: MaskItems.h:44
static const QString P_XLOW
Definition: MaskItems.h:41
SessionItem * insertNewItem(QString model_type, SessionItem *parent_item=nullptr, int row=-1, QString tag="")

References MaskDrawingContext::activityToModelType(), MaskDrawingContext::activityToRow(), MaskDrawingContext::getMaskValue(), SessionModel::insertNewItem(), isDrawingInProgress(), MaskDrawingContext::isROIMode(), m_adaptor, m_context, m_currentItem, m_maskContainerIndex, m_maskModel, SessionItem::modelType(), MaskItem::P_MASK_VALUE, EllipseItem::P_XCENTER, RectangleItem::P_XLOW, EllipseItem::P_XRADIUS, RectangleItem::P_XUP, EllipseItem::P_YCENTER, RectangleItem::P_YLOW, EllipseItem::P_YRADIUS, RectangleItem::P_YUP, setDrawingInProgress(), setItemName(), and SessionItem::setItemValue().

Referenced by mouseMoveEvent(), and mousePressEvent().

Here is the call graph for this function:

◆ processVerticalLineItem()

void MaskGraphicsScene::processVerticalLineItem ( const QPointF &  pos)
private

Definition at line 684 of file MaskGraphicsScene.cpp.

References SessionModel::insertItem(), m_adaptor, m_currentItem, m_maskContainerIndex, m_maskModel, VerticalLineItem::P_POSX, and SessionItem::setItemValue().

Referenced by processLineItem().

Here is the call graph for this function:

◆ removeItemViewFromScene()

void MaskGraphicsScene::removeItemViewFromScene ( SessionItem item)
private

Removes single view from scene.

Definition at line 433 of file MaskGraphicsScene.cpp.

434 {
435  for (auto it = m_ItemToView.begin(); it != m_ItemToView.end(); ++it) {
436  if (it.key() == item) {
437  IShape2DView* view = it.value();
438  view->setSelected(false);
439  m_ItemToView.erase(it);
440  delete view;
441  break;
442  }
443  }
444 }

References m_ItemToView.

Referenced by deleteViews().

◆ resetContext()

void MaskGraphicsScene::resetContext ( )

Definition at line 102 of file MaskGraphicsScene.cpp.

103 {
104  m_intensityItem = nullptr;
105  if (m_maskModel) {
106  disconnect(m_maskModel, &SessionModel::modelAboutToBeReset, this,
108  disconnect(m_maskModel, &SessionModel::rowsInserted, this,
110  disconnect(m_maskModel, &SessionModel::rowsAboutToBeRemoved, this,
112  disconnect(m_maskModel, &SessionModel::rowsRemoved, this,
114  disconnect(m_maskModel, &SessionModel::modelReset, this, &MaskGraphicsScene::updateScene);
115  }
116  m_maskModel = nullptr;
118  resetScene();
119 }
void onRowsInserted(const QModelIndex &, int, int)
void onRowsRemoved(const QModelIndex &, int, int)
void onRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last)

References m_intensityItem, m_maskContainerIndex, m_maskModel, onRowsAboutToBeRemoved(), onRowsInserted(), onRowsRemoved(), resetScene(), and updateScene().

Referenced by ProjectionsEditorCanvas::resetContext(), and MaskEditorCanvas::resetContext().

Here is the call graph for this function:

◆ resetScene

void MaskGraphicsScene::resetScene ( )
slot

Definition at line 184 of file MaskGraphicsScene.cpp.

185 {
187  m_block_selection = true;
188  m_selectionModel->clearSelection();
189  clearSelection();
190 
191  clear();
192  m_ItemToView.clear();
193  m_proxy = 0;
194  m_adaptor.reset(new ColorMapSceneAdaptor);
195 
196  m_block_selection = false;
197 }
Performs conversion of MaskItems coordinates between ColorMap and GraphicsScene.

References ASSERT, m_adaptor, m_block_selection, m_ItemToView, m_proxy, and m_selectionModel.

Referenced by resetContext(), and setMaskContext().

◆ setDrawingInProgress()

void MaskGraphicsScene::setDrawingInProgress ( bool  value)
private

Definition at line 545 of file MaskGraphicsScene.cpp.

546 {
548  if (value == false)
549  m_currentItem = 0;
550 }
void setDrawingInProgress(bool value)

References m_context, m_currentItem, and MaskDrawingContext::setDrawingInProgress().

Referenced by cancelCurrentDrawing(), mouseReleaseEvent(), processLineItem(), processMaskAllItem(), processPolygonItem(), and processRectangleShapeItem().

Here is the call graph for this function:

◆ setInPanAndZoomMode()

void MaskGraphicsScene::setInPanAndZoomMode ( bool  value)
private

Sets the state of all views in pan&zoom mode.

In pan&zoom mode, the selection is removed, all items can't receive mouse clicks, and all events are propagated down to ColorMap plot.

Definition at line 556 of file MaskGraphicsScene.cpp.

557 {
558  if (value)
559  m_selectionModel->clearSelection();
560 
561  Qt::MouseButtons acceptedButton = (value ? Qt::NoButton : Qt::LeftButton);
562  for (IShape2DView* view : m_ItemToView.values())
563  view->setAcceptedMouseButtons(acceptedButton);
564 
565  m_proxy->setInZoomMode(value);
566 }
void setInZoomMode(bool value)
Sets widget to zoom mode, when signals (zoom wheel, mouse clicks) are send down to ColorMap plot.

References m_ItemToView, m_proxy, m_selectionModel, and MaskGraphicsProxy::setInZoomMode().

Referenced by onActivityModeChanged().

Here is the call graph for this function:

◆ setItemName()

void MaskGraphicsScene::setItemName ( SessionItem itemToChange)
private

Sets item name depending on alreay existent items.

If there is already "Rectangle1", the new name will be "Rectangle2"

Definition at line 734 of file MaskGraphicsScene.cpp.

735 {
736  if (itemToChange->modelType() == "RegionOfInterest")
737  return;
738 
739  int glob_index(0);
740  for (int i_row = 0; i_row < m_maskModel->rowCount(m_maskContainerIndex); ++i_row) {
741  QModelIndex itemIndex = m_maskModel->index(i_row, 0, m_maskContainerIndex);
742  if (SessionItem* currentItem = m_maskModel->itemForIndex(itemIndex)) {
743  if (currentItem->modelType() == itemToChange->modelType()) {
744  QString itemName = currentItem->itemName();
745  if (itemName.startsWith(itemToChange->itemName())) {
746  int item_index = itemName.remove(0, itemToChange->itemName().size()).toInt();
747  if (item_index > glob_index)
748  glob_index = item_index;
749  }
750  }
751  }
752  }
753  itemToChange->setItemName(itemToChange->itemName() + QString::number(++glob_index));
754 }
QString itemName() const
Get item name, return display name if no name is set.
void setItemName(const QString &name)
Set item name, add property if necessary.

References SessionModel::index(), SessionModel::itemForIndex(), SessionItem::itemName(), m_maskContainerIndex, m_maskModel, SessionItem::modelType(), SessionModel::rowCount(), and SessionItem::setItemName().

Referenced by processLineItem(), processPolygonItem(), and processRectangleShapeItem().

Here is the call graph for this function:

◆ setMaskContext()

void MaskGraphicsScene::setMaskContext ( SessionModel model,
const QModelIndex &  maskContainerIndex,
IntensityDataItem intensityItem 
)

Definition at line 56 of file MaskGraphicsScene.cpp.

58 {
59  m_intensityItem = intensityItem;
60 
61  if (model != m_maskModel || m_maskContainerIndex != maskContainerIndex) {
62 
63  if (m_maskModel) {
64  disconnect(m_maskModel, &SessionModel::modelAboutToBeReset, this,
66  disconnect(m_maskModel, &SessionModel::rowsInserted, this,
68  disconnect(m_maskModel, &SessionModel::rowsAboutToBeRemoved, this,
70  disconnect(m_maskModel, &SessionModel::rowsRemoved, this,
72  disconnect(m_maskModel, &SessionModel::modelReset, this,
74  }
75 
76  m_maskModel = model;
77 
78  QString containerType = m_maskModel->itemForIndex(maskContainerIndex)->modelType();
79  if (containerType != "MaskContainer" && containerType != "ProjectionContainer")
80  throw GUIHelpers::Error(
81  "MaskGraphicsScene::setMaskContext() -> Error. Not a container");
82 
83  m_maskContainerIndex = maskContainerIndex;
84 
85  if (m_maskModel) {
86  connect(m_maskModel, &SessionModel::modelAboutToBeReset, this,
88  connect(m_maskModel, &SessionModel::rowsInserted, this,
90  connect(m_maskModel, &SessionModel::rowsAboutToBeRemoved, this,
92  connect(m_maskModel, &SessionModel::rowsRemoved, this,
94  connect(m_maskModel, &SessionModel::modelReset, this, &MaskGraphicsScene::updateScene);
95  }
96 
97  resetScene();
98  updateScene();
99  }
100 }

References SessionModel::itemForIndex(), m_intensityItem, m_maskContainerIndex, m_maskModel, SessionItem::modelType(), onRowsAboutToBeRemoved(), onRowsInserted(), onRowsRemoved(), resetScene(), and updateScene().

Referenced by ProjectionsEditorCanvas::setContext(), and MaskEditorCanvas::setMaskContext().

Here is the call graph for this function:

◆ setSelectionModel()

void MaskGraphicsScene::setSelectionModel ( QItemSelectionModel *  model)

Definition at line 121 of file MaskGraphicsScene.cpp.

122 {
123  ASSERT(model);
124  m_selectionModel = model;
125  connect(m_selectionModel, &QItemSelectionModel::selectionChanged, this,
126  &MaskGraphicsScene::onSessionSelectionChanged, Qt::UniqueConnection);
127 }
void onSessionSelectionChanged(const QItemSelection &, const QItemSelection &)
Propagates selection from model to scene.

References ASSERT, m_selectionModel, and onSessionSelectionChanged().

Referenced by ProjectionsEditorCanvas::setSelectionModel(), and MaskEditorCanvas::setSelectionModel().

Here is the call graph for this function:

◆ setZValues()

void MaskGraphicsScene::setZValues ( )
private

Update Z-values of all IMaskView to reflect stacking order in SessionModel.

Item with irow=0 is the top most on graphics scene (and so is having largest z-values).

Definition at line 708 of file MaskGraphicsScene.cpp.

709 {
710  ASSERT(m_maskContainerIndex.isValid());
711  for (int i = 0; i < m_maskModel->rowCount(m_maskContainerIndex); i++) {
712  QModelIndex itemIndex = m_maskModel->index(i, 0, m_maskContainerIndex);
713  SessionItem* item = m_maskModel->itemForIndex(itemIndex);
714  if (IShape2DView* view = m_ItemToView[item])
715  view->setZValue(m_maskModel->rowCount(m_maskContainerIndex) - itemIndex.row() + 1);
716  }
717 }

References ASSERT, SessionModel::index(), SessionModel::itemForIndex(), m_ItemToView, m_maskContainerIndex, m_maskModel, and SessionModel::rowCount().

Referenced by updateScene().

Here is the call graph for this function:

◆ updateCursors()

void MaskGraphicsScene::updateCursors ( )
private

Change cursor to stress that hovered item is movable (when not in PanZoom mode)

Definition at line 570 of file MaskGraphicsScene.cpp.

571 {
572  for (auto it = m_ItemToView.begin(); it != m_ItemToView.end(); ++it) {
573  if (it.key()->modelType() == "VerticalLineMask") {
574  it.value()->setCursor(m_context.isInZoomMode() ? Qt::ArrowCursor : Qt::SizeHorCursor);
575  } else if (it.key()->modelType() == "HorizontalLineMask") {
576  it.value()->setCursor(m_context.isInZoomMode() ? Qt::ArrowCursor : Qt::SizeVerCursor);
577  }
578  }
579 }

References MaskDrawingContext::isInZoomMode(), m_context, and m_ItemToView.

Referenced by onActivityModeChanged().

Here is the call graph for this function:

◆ updateProxyWidget()

void MaskGraphicsScene::updateProxyWidget ( )
private

Updates proxy widget for intensity data item.

Definition at line 366 of file MaskGraphicsScene.cpp.

367 {
369  if (!m_proxy) {
373  addItem(m_proxy);
374  }
375 }
Graphics proxy to place QWidget inside QGraphicsScene, used by MaskEditorCanvas.
void setIntensityItem(IntensityDataItem *item)

References ASSERT, m_adaptor, m_intensityItem, m_proxy, MaskGraphicsProxy::setIntensityItem(), and MaskGraphicsProxy::setSceneAdaptor().

Referenced by updateScene().

Here is the call graph for this function:

◆ updateScene

void MaskGraphicsScene::updateScene ( )
slot

Main method to update scene on various changes in the model.

Definition at line 201 of file MaskGraphicsScene.cpp.

202 {
203  if (!m_maskModel)
204  return;
205 
209  setZValues();
210 }
void setZValues()
Update Z-values of all IMaskView to reflect stacking order in SessionModel.
void updateViews(const QModelIndex &parentIndex={}, IShape2DView *parentView=0)
Recutsively runs through the model and creates corresponding views.
IShape2DView * addViewForItem(SessionItem *item)
Creates a view for given item.
void updateProxyWidget()
Updates proxy widget for intensity data item.

References addViewForItem(), SessionModel::itemForIndex(), m_maskContainerIndex, m_maskModel, setZValues(), updateProxyWidget(), and updateViews().

Referenced by onRowsInserted(), onRowsRemoved(), resetContext(), and setMaskContext().

Here is the call graph for this function:

◆ updateViews()

void MaskGraphicsScene::updateViews ( const QModelIndex &  parentIndex = {},
IShape2DView parentView = 0 
)
private

Recutsively runs through the model and creates corresponding views.

Definition at line 379 of file MaskGraphicsScene.cpp.

380 {
382  IShape2DView* childView(0);
383  for (int i_row = 0; i_row < m_maskModel->rowCount(parentIndex); ++i_row) {
384  QModelIndex itemIndex = m_maskModel->index(i_row, 0, parentIndex);
385  if (SessionItem* item = m_maskModel->itemForIndex(itemIndex)) {
386  if (item->modelType() == "GroupProperty" || item->modelType() == "Property")
387  continue;
388 
389  childView = addViewForItem(item);
390  if (childView) {
391  if (parentView)
392  parentView->addView(childView, i_row);
393  }
394  }
395  updateViews(itemIndex, childView);
396  }
397 }
virtual void addView(IShape2DView *childView, int row=0)

References IShape2DView::addView(), addViewForItem(), ASSERT, SessionModel::index(), SessionModel::itemForIndex(), m_maskModel, and SessionModel::rowCount().

Referenced by updateScene().

Here is the call graph for this function:

Member Data Documentation

◆ m_adaptor

◆ m_block_selection

bool MaskGraphicsScene::m_block_selection
private

◆ m_context

◆ m_currentItem

◆ m_currentMousePosition

QPointF MaskGraphicsScene::m_currentMousePosition
private

Definition at line 121 of file MaskGraphicsScene.h.

Referenced by drawForeground(), mouseMoveEvent(), and processPolygonItem().

◆ m_intensityItem

IntensityDataItem* MaskGraphicsScene::m_intensityItem
private

Definition at line 119 of file MaskGraphicsScene.h.

Referenced by resetContext(), setMaskContext(), and updateProxyWidget().

◆ m_ItemToView

◆ m_maskContainerIndex

◆ m_maskModel

◆ m_proxy

MaskGraphicsProxy* MaskGraphicsScene::m_proxy
private

◆ m_selectionModel

QItemSelectionModel* MaskGraphicsScene::m_selectionModel
private

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