Skip to content

Commit

Permalink
fix in New Score > Create From Template
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-shinde-442 committed Nov 29, 2024
1 parent 7884d9a commit 0553ee4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ Item {
onCurrentTemplateChanged: {
templatePreview.load(model.currentTemplatePath)
}

onSearchRequested: {
templatesView.activateSearchField()
}
}

Component.onCompleted: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ Item {
searchField.clear()
}

function activateSearchField() {
searchField.forceActiveFocus()
}

StyledTextLabel {
id: title

Expand Down
4 changes: 4 additions & 0 deletions src/project/view/templatesmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ void TemplatesModel::load()
}
}

dispatcher()->reg(this, "req-dialog-search", [this]() {
emit searchRequested();
});

loadAllCategories();
}

Expand Down
6 changes: 5 additions & 1 deletion src/project/view/templatesmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@
#define MU_PROJECT_TEMPLATESMODEL_H

#include "modularity/ioc.h"
#include "actions/iactionsdispatcher.h"
#include "actions/actionable.h"
#include "internal/itemplatesrepository.h"

namespace mu::project {
class TemplatesModel : public QObject
class TemplatesModel : public QObject, public muse::actions::Actionable
{
Q_OBJECT

INJECT(ITemplatesRepository, repository)
INJECT(muse::actions::IActionsDispatcher, dispatcher)

Q_PROPERTY(QStringList categoriesTitles READ categoriesTitles NOTIFY categoriesChanged)
Q_PROPERTY(QStringList templatesTitles READ templatesTitles NOTIFY templatesChanged)
Expand Down Expand Up @@ -65,6 +68,7 @@ public slots:
void templatesChanged();
void currentCategoryChanged();
void currentTemplateChanged();
void searchRequested();

private:
void loadAllCategories();
Expand Down

0 comments on commit 0553ee4

Please sign in to comment.