20 #include <QItemSelectionModel>
25 , m_toggleMaskValueAction(new QAction(
"Toggle mask value", parent))
26 , m_bringToFrontAction(new QAction(
"Rise mask up", parent))
27 , m_sendToBackAction(new QAction(
"Lower mask down", parent))
28 , m_deleteMaskAction(new QAction(
"Remove mask", parent))
29 , m_resetViewAction(new QAction(this))
30 , m_savePlotAction(new QAction(this))
31 , m_maskModel(nullptr)
32 , m_selectionModel(nullptr)
112 while (!indexes.empty()) {
125 item->setMaskValue(!item->maskValue());
145 int change_in_row(0);
153 for (
auto itemIndex : indexes) {
155 int new_row = itemIndex.row() + change_in_row;
156 if (new_row >= 0 && new_row <= m_maskModel->rowCount(
m_rootIndex)) {
160 QItemSelectionModel::Select);
174 if (indexes.size() == 1 && indexes.front().row() != 0)
184 if (indexes.size() == 1) {
Defines class ActionFactory.
Defines class MaskEditorActions.
Defines MaskItems classes.
Defines class SessionModel.
static QAction * createTogglePropertiesPanelAction(QObject *parent, QWidget *toggledWidget=nullptr)
Create "toggle properties panel" action.
QItemSelectionModel * m_selectionModel
Index in the model corresponding to IntensityDataItem.
bool isSendToBackPossible() const
Returns true if at least one of MaskItems in the selection can be moved one level down.
QAction * m_toggleMaskValueAction
QList< QAction * > topToolbarActions()
void propertyPanelRequest()
QAction * m_togglePanelAction
void onToggleMaskValueAction()
Performs switch of mask value for all selected items (true -> false, false -> true)
MaskEditorActions(QWidget *parent)
void onItemContextMenuRequest(const QPoint &point)
Constructs MaskItem context menu following the request from MaskGraphicsScene or MaskEditorInfoPanel.
void setAllActionsEnabled(bool value)
QAction * m_bringToFrontAction
QAction * m_sendToBackAction
QAction * m_deleteMaskAction
void setModel(SessionModel *maskModel, const QModelIndex &rootIndex)
void changeMaskStackingOrder(MaskEditorFlags::Stacking value)
Lower mask one level down or rise one level up in the masks stack.
QAction * bringToFrontAction()
QAction * m_savePlotAction
void initItemContextMenu(QMenu &menu)
Init external context menu with currently defined actions. Triggered from MaskGraphicsScene of MaskEd...
void onSendToBackAction()
QAction * sendToBackAction()
bool isBringToFrontPossible() const
Returns true if at least one of MaskItems in the selection can be moved one level up (Naturally,...
void onBringToFrontAction()
SessionModel * m_maskModel
QAction * m_resetViewAction
void setSelectionModel(QItemSelectionModel *selectionModel)
void onDeleteMaskAction()
A base class for all mask items.
Base class for a GUI data item.
int numberOfChildren() const
Returns total number of children.
SessionItem * parentItem() const
Returns parent of this item.
Base class for a GUI data collection. A collection is e.g. all real data (RealDataModel)....
SessionItem * moveItem(SessionItem *item, SessionItem *new_parent=nullptr, int row=-1, const QString &tag="")
Move given parameterized item to the new_parent at given row. If new_parent is not defined,...
SessionItem * itemForIndex(const QModelIndex &index) const
bool removeRows(int row, int count, const QModelIndex &parent) override
QModelIndex indexOfItem(SessionItem *item) const