Skip to content

Commit

Permalink
Merge pull request #18531 from RomanPudashkin/fix_updating_offset_pro…
Browse files Browse the repository at this point in the history
…perty_410

fix_updating_offset_property_410
  • Loading branch information
RomanPudashkin committed Jul 11, 2023
2 parents 9b84698 + 0423c03 commit 2e3a93a
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/inspector/models/abstractinspectorproxymodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class AbstractInspectorProxyModel : public AbstractInspectorModel

void updateModels(const ElementKeySet& newElementKeySet);

void onCurrentNotationChanged() override;

public slots:
void setDefaultSubModelType(mu::inspector::InspectorModelType modelType);

Expand All @@ -74,8 +76,6 @@ public slots:
void setModels(const QList<AbstractInspectorModel*>& models);

private:
void onCurrentNotationChanged() override;

QHash<InspectorModelType, AbstractInspectorModel*> m_modelsHash;
InspectorModelType m_defaultSubModelType = InspectorModelType::TYPE_UNDEFINED;
};
Expand Down
28 changes: 14 additions & 14 deletions src/inspector/models/general/generalsettingsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ GeneralSettingsModel::GeneralSettingsModel(QObject* parent, IElementRepositorySe

setTitle(qtrc("inspector", "General"));
setSectionType(InspectorSectionType::SECTION_GENERAL);
setPlaybackProxyModel(new PlaybackProxyModel(this, repository));
setAppearanceSettingsModel(new AppearanceSettingsModel(this, repository));

m_playbackProxyModel = new PlaybackProxyModel(this, repository);
m_playbackProxyModel->init();

m_appearanceSettingsModel = new AppearanceSettingsModel(this, repository);
m_appearanceSettingsModel->init();
}

void GeneralSettingsModel::createProperties()
Expand Down Expand Up @@ -124,6 +128,14 @@ void GeneralSettingsModel::loadProperties(const mu::engraving::PropertyIdSet& pr
}
}

void GeneralSettingsModel::onCurrentNotationChanged()
{
AbstractInspectorModel::onCurrentNotationChanged();

m_appearanceSettingsModel->onCurrentNotationChanged();
m_playbackProxyModel->onCurrentNotationChanged();
}

void GeneralSettingsModel::onVisibleChanged(bool visible)
{
beginCommand();
Expand Down Expand Up @@ -167,15 +179,3 @@ QObject* GeneralSettingsModel::appearanceSettingsModel() const
{
return m_appearanceSettingsModel;
}

void GeneralSettingsModel::setPlaybackProxyModel(PlaybackProxyModel* playbackProxyModel)
{
m_playbackProxyModel = playbackProxyModel;
emit playbackProxyModelChanged(m_playbackProxyModel);
}

void GeneralSettingsModel::setAppearanceSettingsModel(AppearanceSettingsModel* appearanceSettingsModel)
{
m_appearanceSettingsModel = appearanceSettingsModel;
emit appearanceSettingsModelChanged(m_appearanceSettingsModel);
}
12 changes: 3 additions & 9 deletions src/inspector/models/general/generalsettingsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class GeneralSettingsModel : public AbstractInspectorModel
Q_PROPERTY(PropertyItem * isPlayable READ isPlayable CONSTANT)
Q_PROPERTY(PropertyItem * isSmall READ isSmall CONSTANT)

Q_PROPERTY(QObject * playbackProxyModel READ playbackProxyModel NOTIFY playbackProxyModelChanged)
Q_PROPERTY(QObject * appearanceSettingsModel READ appearanceSettingsModel NOTIFY appearanceSettingsModelChanged)
Q_PROPERTY(QObject * playbackProxyModel READ playbackProxyModel CONSTANT)
Q_PROPERTY(QObject * appearanceSettingsModel READ appearanceSettingsModel CONSTANT)

public:
explicit GeneralSettingsModel(QObject* parent, IElementRepositoryService* repository);
Expand All @@ -50,13 +50,7 @@ class GeneralSettingsModel : public AbstractInspectorModel
QObject* playbackProxyModel() const;
QObject* appearanceSettingsModel() const;

public slots:
void setPlaybackProxyModel(mu::inspector::PlaybackProxyModel* playbackProxyModel);
void setAppearanceSettingsModel(mu::inspector::AppearanceSettingsModel* appearanceSettingsModel);

signals:
void playbackProxyModelChanged(QObject* playbackProxyModel);
void appearanceSettingsModelChanged(QObject* appearanceSettingsModel);
void onCurrentNotationChanged() override;

private:
void createProperties() override;
Expand Down
4 changes: 4 additions & 0 deletions src/inspector/models/general/playback/playbackproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,9 @@ PlaybackProxyModel::PlaybackProxyModel(QObject* parent, IElementRepositoryServic
new GradualTempoChangePlaybackModel(this, repository)
};

for (AbstractInspectorModel* model : models) {
model->init();
}

setModels(models);
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ BarlineSettingsProxyModel::BarlineSettingsProxyModel(QObject* parent, IElementRe
new StaffSettingsModel(this, repository)
};

for (AbstractInspectorModel* model : models) {
model->init();
}

setModels(models);
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ NoteSettingsProxyModel::NoteSettingsProxyModel(QObject* parent, IElementReposito
models << inspectorModelCreator()->newInspectorModel(modelType, this, repository);
}

for (AbstractInspectorModel* model : models) {
model->init();
}

setModels(models);

connect(m_repository->getQObject(), SIGNAL(elementsUpdated(const QList<mu::engraving::EngravingItem*>&)), this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ RestBeamSettingsModel::RestBeamSettingsModel(QObject* parent, IElementRepository
{
setModelType(InspectorModelType::TYPE_BEAM);
setTitle(qtrc("inspector", "Beam"));
setBeamModesModel(new BeamModesModel(this, repository));

BeamModesModel* modesModel = new BeamModesModel(this, repository);
modesModel->init();

setBeamModesModel(modesModel);
}

QObject* RestBeamSettingsModel::beamModesModel() const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ RestSettingsProxyModel::RestSettingsProxyModel(QObject* parent, IElementReposito
models << inspectorModelCreator()->newInspectorModel(modelType, this, repository);
}

for (AbstractInspectorModel* model : models) {
model->init();
}

setModels(models);

connect(m_repository->getQObject(), SIGNAL(elementsUpdated(const QList<mu::engraving::EngravingItem*>&)), this,
Expand Down

0 comments on commit 2e3a93a

Please sign in to comment.