Skip to content
Snippets Groups Projects
Commit d2b6e572 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

inline fcts

parent c6a2a32c
No related branches found
No related tags found
1 merge request!2294mv functionality to model; mask toolbar separator now using setStyleSheet
......@@ -83,11 +83,14 @@ void MaskEditorActions::onItemContextMenuRequest(const QPoint& point)
ASSERT(m_mask_list_model);
ASSERT(m_selection_model);
if (m_selection_model->selectedIndexes().isEmpty())
QModelIndexList indexes = m_selection_model->selectedIndexes();
if (indexes.isEmpty())
setAllActionsEnabled(false);
m_send_to_back_action->setEnabled(canBringToBack());
m_bring_to_front_action->setEnabled(canBringToFront());
const bool canBringToBack = (indexes.front().row() != 0);
m_send_to_back_action->setEnabled(canBringToBack);
const bool canBringToFront =
(indexes.front().row() != m_mask_list_model->maskContItem()->size() - 1);
m_bring_to_front_action->setEnabled(canBringToFront);
QMenu menu;
menu.addAction(m_toggle_mask_value_action);
......@@ -152,28 +155,6 @@ void MaskEditorActions::changeMaskStackingOrder(bool move_up)
gDoc->setModified();
}
//! Returns true if at least one of MaskItems in the selection can be moved one level up
//! (Naturally, it is always true, if selection contains more than one item. If selection contains
//! only one item, the result will depend on position of item on the stack.
//! Top item cannot be moved up. Used to disable corresponding context menu line.)
bool MaskEditorActions::canBringToFront() const
{
QModelIndexList indexes = m_selection_model->selectedIndexes();
if (indexes.size() == 1 && indexes.front().row() != 0)
return true;
return false;
}
//! Returns true if at least one of MaskItems in the selection can be moved one level down.
bool MaskEditorActions::canBringToBack() const
{
QModelIndexList indexes = m_selection_model->selectedIndexes();
if (indexes.size() == 1
&& indexes.front().row() != m_mask_list_model->maskContItem()->size() - 1)
return true;
return false;
}
void MaskEditorActions::setAllActionsEnabled(bool value)
{
m_send_to_back_action->setEnabled(value);
......
......@@ -53,8 +53,6 @@ private slots:
private:
void changeMaskStackingOrder(bool move_up);
bool canBringToFront() const;
bool canBringToBack() const;
void setAllActionsEnabled(bool value);
QAction* m_toggle_mask_value_action;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment