Skip to content

Commit

Permalink
qmlui: improve Scene editor fixture selection
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallegari committed Nov 24, 2024
1 parent 456f228 commit 97756c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 31 deletions.
3 changes: 3 additions & 0 deletions qmlui/modelselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ void ModelSelector::selectSingleItem(int index, ListModel *model)
model->setDataWithRole(idx, "isSelected", true);
m_selectedIndices.append(index);
m_itemsCount++;

emit itemSelectionChanged(index, true);
}

void ModelSelector::selectItem(int index, ListModel *model, int keyModifiers)
Expand Down Expand Up @@ -78,6 +80,7 @@ void ModelSelector::resetSelection(ListModel *model)
{
QModelIndex idx = model->index(int(sidx), 0, QModelIndex());
model->setDataWithRole(idx, "isSelected", false);
emit itemSelectionChanged(sidx, false);
}

m_selectedIndices.clear();
Expand Down
1 change: 1 addition & 0 deletions qmlui/modelselector.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class ModelSelector : public QObject

signals:
void itemsCountChanged(int itemsCount);
void itemSelectionChanged(int itemIndex, bool selected);

private:
/** List of the currently selected item indices */
Expand Down
46 changes: 15 additions & 31 deletions qmlui/qml/fixturesfunctions/SceneEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,17 @@ Rectangle
ModelSelector
{
id: seSelector
onItemsCountChanged: console.log("Scene Editor selected items changed!")
//onItemsCountChanged: console.log("Scene Editor selected items changed!")
onItemSelectionChanged:
{
var item = sfxList.itemAtIndex(itemIndex)
if (item.itemType === App.FixtureDragItem)
{
contextManager.setFixtureIDSelection(item.itemId, selected)
if (selected)
sceneEditor.setFixtureSelection(item.itemId)
}
}
}

TimeEditTool
Expand Down Expand Up @@ -238,6 +248,7 @@ Rectangle
color: "transparent"

property int itemType: model.type
property int itemId: model.cRef.id

Rectangle
{
Expand Down Expand Up @@ -273,44 +284,17 @@ Rectangle

onClicked:
{
seSelector.selectItem(index, sfxList.model, mouse.modifiers)

if (compDelegate.itemType === App.FixtureDragItem)
{
if (!(mouse.modifiers & Qt.ControlModifier))
if (!mouse.modifiers)
contextManager.resetFixtureSelection()

contextManager.setFixtureIDSelection(model.cRef.id, true)
sceneEditor.setFixtureSelection(model.cRef.id)
}
}
//onDoubleClicked: fxDelegate.mouseEvent(App.DoubleClicked, cRef.id, cRef.type, fxDelegate, -1)
}
}
}
/*
FixtureDelegate
{
cRef: model.cRef
width: seContainer.width
isSelected: model.isSelected
Component.onCompleted: contextManager.setFixtureIDSelection(cRef.id, true)
Component.onDestruction: if (contextManager) contextManager.setFixtureIDSelection(cRef.id, false)
onMouseEvent:
{
if (type === App.Clicked)
{
seSelector.selectItem(index, sfxList.model, mouseMods)
if (!(mouseMods & Qt.ControlModifier))
contextManager.resetFixtureSelection()

contextManager.setFixtureIDSelection(cRef.id, true)
sceneEditor.setFixtureSelection(cRef.id)
seSelector.selectItem(index, sfxList.model, mouse.modifiers)
}
}
}
}
*/

DropArea
{
Expand Down

0 comments on commit 97756c0

Please sign in to comment.