Skip to content

Commit

Permalink
fix #280347: reset inspector if property change leads to selection ch…
Browse files Browse the repository at this point in the history
…ange
  • Loading branch information
dmitrio95 committed Dec 21, 2018
1 parent 7c71ea7 commit e39e283
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions mscore/inspector/inspector.cpp
Expand Up @@ -358,6 +358,7 @@ void Inspector::update(Score* s)
break;
}
}
connect(ie, &InspectorBase::elementChanged, this, QOverload<>::of(&Inspector::update), Qt::QueuedConnection);
sa->setWidget(ie); // will destroy previous set widget

//focus policies were set by hand in each inspector_*.ui. this code just helps keeping them like they are
Expand Down
11 changes: 10 additions & 1 deletion mscore/inspector/inspectorBase.cpp
Expand Up @@ -384,7 +384,8 @@ void InspectorBase::valueChanged(int idx, bool reset)
const InspectorItem& ii = iList[idx];
Pid id = ii.t;
QVariant val2 = getValue(ii); // get new value from UI
Score* score = inspector->element()->score();
Element* iElement = inspector->element();
Score* score = iElement->score();

score->startCmd();
for (Element* e : *inspector->el()) {
Expand Down Expand Up @@ -413,6 +414,14 @@ void InspectorBase::valueChanged(int idx, bool reset)
checkDifferentValues(ii);
score->endCmd();
inspector->setInspectorEdit(false);

if (iElement != inspector->element()) {
// Something changed in selection as a result of value change.
recursion = false;
emit elementChanged();
return;
}

postInit();

// a subStyle change may change several other values:
Expand Down
3 changes: 3 additions & 0 deletions mscore/inspector/inspectorBase.h
Expand Up @@ -54,6 +54,9 @@ class InspectorBase : public QWidget {
bool compareValues(const InspectorItem& ii, QVariant a, QVariant b);
Element* effectiveElement(const InspectorItem&) const;

signals:
void elementChanged();

private slots:
void resetToStyle();

Expand Down

0 comments on commit e39e283

Please sign in to comment.